felselva / mathc

Pure C math library for 2D and 3D programming
zlib License
703 stars 56 forks source link

About clamp feature #30

Closed heitaoflower closed 5 years ago

heitaoflower commented 5 years ago

Hi, I just wondering if you can add a feature of clamp, both of clampi and clampf

something like that,

define CLAMP(value, min, max) (min < max \

? (value < min ? min : value > max ? max : value) \ : (value < max ? max : value > min ? min : value) \ )

mfloat_t clampf(float value, float min, float max); int clampf(int value, int min, int max);

I am will vrey glad to see u do that.

felselva commented 5 years ago

Will send a patch soon.