1 2 3 4 5 6 7 8 9 10
#include "maths.h" float clamp( float* x, float *min, float *max ){ if (*x < *min) return *min; else if (*x > *max) return *max; else return *x; }