From 685554b2c272fdefc23bb1d237c059b52ab5fc58 Mon Sep 17 00:00:00 2001 From: Wiimm Date: Sat, 17 Feb 2024 11:45:01 +0100 Subject: SZS v2.41a --- project/dclib/dclib-numeric.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'project/dclib/dclib-numeric.h') diff --git a/project/dclib/dclib-numeric.h b/project/dclib/dclib-numeric.h index 1ad805c..c2ddf3b 100644 --- a/project/dclib/dclib-numeric.h +++ b/project/dclib/dclib-numeric.h @@ -259,6 +259,40 @@ bool IsSameD3 ( const double *a, const double *b, int bit_diff ); #define rad2deg(n) ( (n)*(180.0/M_PI) ) #define deg2rad(n) ( (n)*(M_PI/180.0) ) +// +/////////////////////////////////////////////////////////////////////////////// +/////////////// progress helper /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[progress_t]] + +// [[doxygen]] +typedef struct progress_t +{ + // all times are set by GetTimerMSec() + + u_msec_t interval_msec; // 0=off, >0: minimum distance between 2 logs + u_msec_t start_msec; // start time of progress + u_msec_t last_log_msec; // time of last log + uint counter; // current counter + uint last_counter; // count at last log +} +progress_t; + +//----------------------------------------------------------------------------- + +void StartProgress ( progress_t *pr, u_msec_t interval_msec ); +bool CheckProgress ( progress_t *pr ); +bool FinalProgress ( progress_t *pr ); + +static inline void ResetProgress ( progress_t *pr ) + { DASSERT(pr); memset(pr,0,sizeof(*pr)); } + +static inline uint IncrementProgress ( progress_t *pr ) + { DASSERT(pr); return ++pr->counter; } + +static inline uint AddProgress ( progress_t *pr, uint add ) + { DASSERT(pr); return pr->counter += add; } + // /////////////////////////////////////////////////////////////////////////////// /////////////// 2D vector functions /////////////// -- cgit v1.3.1