#include #include #include "misc.h" //Signum function #ifdef WIN32 _inline int isign(float i) #else inline int isign(float i) #endif { if (i<0) return -1; if (i>0) return 1; return 0; } #ifdef WIN32 _inline unsigned clamp_flt(float f, float min, float max) #else inline unsigned clamp_flt(float f, float min, float max) #endif { if(fmax) return 255; return (int)(255.0f*(f-min)/(max-min)); } #ifdef WIN32 _inline float restrict_flt(float f, float min, float max) #else inline float restrict_flt(float f, float min, float max) #endif { if(fmax) return max; return f; } char *mystrdup(char *s) { char *x; if(s) { x = malloc(strlen(s)+1); strcpy(x, s); return x; } return s; }