aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
blob: 1d013f77f18987a1cac5cd5689e41c4688474d78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "gameCommon.h"

#ifndef UTIL_H
#define UTIL_H

// Bit shit.
#define SET_BIT(b, n) (b | (0x1 << n))
#define CLEAR_BIT(b, n) (b & ~(0x1 << n))
#define IS_BIT_SET(b, n) ((b >> n) & 0x1)
#define TOGGLE_BIT(b, n) (b ^ (0x1 << n))
#define HAS_FLAG(v, f) ((v & f) == f)

typedef struct AxisAngle {
	Vector3 axis;
	float angle;
} AxisAngle;

AxisAngle AxisAngleIdentity();

float signum(float n);
float closestAngle(float a1, float a2);

#endif