Engine
Raylib based game framework
Loading...
Searching...
No Matches
Types.h
1#pragma once
2
3#include <stdint.h>
4
5/* signed types */
6typedef int8_t i8;
7typedef int16_t i16;
8typedef int32_t i32;
9typedef int64_t i64;
10
11/* unsigned types */
12typedef uint8_t u8;
13typedef uint16_t u16;
14typedef uint32_t u32;
15typedef uint64_t u64;
16
17/* floating point types */
18typedef float f32;
19typedef double f64;
20
21/* boolean types */
22typedef u8 b8;
23typedef u16 b16;
24typedef u32 b32;
25typedef u64 b64;
26
27/* memory size macros */
28#define B(x) (x)
29#define KB(x) ((x) << 10)
30#define MB(x) ((x) << 20)
31#define GB(x) ((x) << 30)
32#define TB(x) (((u64)x) << 40)
33
34/* signed constants */
35static const i8 MAX_I8 = 127;
36static const i16 MAX_I16 = 32767;
37static const i32 MAX_I32 = 2147483647;
38static const i64 MAX_I64 = 9223372036854775807;
39static const i8 MIN_I8 = -127 - 1;
40static const i16 MIN_I16 = -32767 - 1;
41static const i32 MIN_I32 = -2147483647 - 1;
42static const i64 MIN_I64 = -9223372036854775807 - 1;
43
44/* unsigned constants */
45static const u8 MAX_U8 = 0xFF; // 255
46static const u16 MAX_U16 = 0xFFFF; // 65535
47static const u32 MAX_U32 = 0xFFFFFFFF; // 4294967295
48static const u64 MAX_U64 = 0xFFFFFFFFFFFFFFFF; // 18446744073709551615
49
50/* floating point constants */
51static const f32 MAX_F32 = 3.402823466e+38f;
52static const f32 MIN_F32 = -3.402823466e+38f;
53static const f32 SMALLEST_POSITIVE_F32 = 1.1754943508e-38f;
54static const f32 EPSILON_F32 = 5.96046448e-8f;
55static const f32 PI_F32 = 3.14159265359f;
56static const f32 HALF_PI_F32 = 1.5707963267f;
57static const f64 MAX_F64 = 1.79769313486231e+308;
58static const f64 MIN_F64 = -1.79769313486231e+308;
59static const f64 SMALLEST_POSITIVE_F64 = 4.94065645841247e-324;
60static const f64 EPSILON_F64 = 1.11022302462515650e-16;