summaryrefslogtreecommitdiff
path: root/shared/util.h
blob: 230c3e4a29dd75130f277472d2f7c6f6832673c0 (plain)
1
2
3
4
5
6
7
8
9
10
#pragma once

/** @file util.h */

#define W2_MIN(a, b) (((a) < (b)) ? (a) : (b))
#define W2_MAX(a, b) (((a) > (b)) ? (a) : (b))
#define W2_RANGE(min, val, max) W2_MIN(max, W2_MAX(val, min))

unsigned long w2_util_exp_mov_avg(unsigned long current_avg, unsigned long new_meas);
int w2_sign(int n);