#include "math.h"

unsigned long fred_sqrt(unsigned long x);
long fixed_sqrt(long x);
int calcFrame(long velx, long vely);

#ifndef min
#define min(x, y) (x < y ? x : y)
#endif

#define sqr(x) (x * x)

//define HYPOT(x, y) fixed_sqrt(sqr(x)+sqr(y))
#define HYPOT(x, y) (((x == 0) && (y == 0)) ? 0 : INT(hypot(x,y)))
//define HYPOT(x, y) fred_sqrt(sqr(x)+sqr(y))

#ifdef _WIN32

#define INT(x) int(x)

#else

#ifdef __linux__

#define INT(x) int(x)

#else

#define INT(x) rint(x)

#endif

#endif


