2018-09-05 01:50:14 +00:00
|
|
|
#ifndef UTIL_H
|
|
|
|
|
2018-09-06 01:48:27 +00:00
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
|
|
|
|
// CONSTANTS
|
|
|
|
const float EPSILON_E3 = 1E-3f;
|
|
|
|
|
2018-09-05 01:50:14 +00:00
|
|
|
|
|
|
|
// MACROS
|
|
|
|
#define SET_BIT(x, bit) (x |= (1UL << bit))
|
|
|
|
#define CLEAR_BIT(x, bit) (x &= ~(1UL << bit))
|
|
|
|
#define CHECK_BIT(x, bit) (x & (1UL << bit))
|
2018-09-06 01:48:27 +00:00
|
|
|
#define DEG_TO_RAD(deg) ((deg * (float)M_PI) / 180.0f)
|
|
|
|
#define SWAP(a, b, temp) {temp = a; a = b; b = temp;}
|
2018-09-06 02:26:54 +00:00
|
|
|
#define MIN(a, b) ((a < b) ? a : b)
|
|
|
|
#define MAX(a, b) ((a > b) ? a : b)
|
2018-09-06 01:48:27 +00:00
|
|
|
#define FLOAT_EQUAL(a, b) ((fabsf(a - b) < EPSILON_E3) ? 1 : 0)
|
2018-09-05 01:50:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define UTIL_H
|
|
|
|
#endif
|
|
|
|
|