diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-06-07 21:27:16 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-06-07 21:27:16 +0200 |
commit | 3e65c70da770fa31fc8acc6ab9374d908cf1ed17 (patch) | |
tree | 14f8d4c708faccc8b3f992a022f940c00ed694f9 /shared/util.h | |
parent | 8c8322a7a0c251d595a0df054324f82d41966e0a (diff) |
implement orders
Diffstat (limited to 'shared/util.h')
-rw-r--r-- | shared/util.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/shared/util.h b/shared/util.h index 230c3e4..806af3a 100644 --- a/shared/util.h +++ b/shared/util.h @@ -6,5 +6,9 @@ #define W2_MAX(a, b) (((a) > (b)) ? (a) : (b)) #define W2_RANGE(min, val, max) W2_MIN(max, W2_MAX(val, min)) +/** calculate exponential moving average */ unsigned long w2_util_exp_mov_avg(unsigned long current_avg, unsigned long new_meas); +/** return the sign of a number (-1 or 1) */ int w2_sign(int n); +/** return amount of newline characters */ +unsigned int w2_newline_count(char *str, unsigned int len); |