jtmm2/src/util.c

26 lines
249 B
C

#include "util.h"
int
sign(int x)
{
return (x > 0) - (x < 0);
}
float
absf(float x)
{
return x * (-1 + 2 * (x > 0));
}
float
minf(float x, float y)
{
return (x < y) ? (x) : (y);
}
float
maxf(float x, float y)
{
return (x > y) ? (x) : (y);
}