1
0
Fork 0
2018-soft-3d-renderer/include/util.h

24 lines
498 B
C
Raw Normal View History

#ifndef UTIL_H
#include <cmath>
// CONSTANTS
const float EPSILON_E3 = 1E-3f;
// 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))
#define DEG_TO_RAD(deg) ((deg * (float)M_PI) / 180.0f)
#define SWAP(a, b, temp) {temp = a; a = b; b = temp;}
#define MIN(a, b) ((a < b) ? a : b)
#define MAX(a, b) ((a > b) ? a : b)
#define FLOAT_EQUAL(a, b) ((fabsf(a - b) < EPSILON_E3) ? 1 : 0)
#define UTIL_H
#endif