#ifndef XMATH_H
#define XMATH_H

#ifdef __cplusplus
extern "C++"
{
template <typename T>
  T clamp(const T &value, const T &low, const T &high)
  {
    return value < low ? low : (value > high ? high : value);
  }
}

#endif

#define RANGE(i, min, max) ((i > min) && (i < max)) ? true : false

#define NCLAMP(x, min, max) (x - min) / (max - min)


#endif