bad char
[vg.git] / vg_platform.h
1 #pragma once
2
3 #include <stdlib.h>
4 #include <stdint.h>
5
6 typedef uint8_t u8;
7 typedef uint16_t u16;
8 typedef uint32_t u32;
9 typedef uint64_t u64;
10 typedef int8_t i8;
11 typedef int16_t i16;
12 typedef int32_t i32;
13 typedef int64_t i64;
14 typedef float f32;
15 typedef double f64;
16 typedef uint8_t bool;
17
18 typedef unsigned int uint;
19 typedef int v2i[2];
20 typedef int v3i[3];
21 typedef int v4i[4];
22 typedef float v2f[2];
23 typedef float v3f[3];
24 typedef float v4f[4];
25 typedef v2f m2x2f[2];
26 typedef v3f m3x3f[3];
27 typedef v3f m4x3f[4];
28 typedef v4f m4x4f[4];
29 typedef v3f boxf[2];
30
31 /* anything compiled against VG shall implement this function somewhere. */
32 void vg_fatal_error( const char *fmt, ... );
33
34 #define VG_ASSERT( ITEM, ... ) \
35 if( !( ITEM ) ) { \
36 vg_fatal_error( "Assertion failed: " VG_LOG_MCSTR(ITEM) "\n" \
37 VG_LOG_WHERE ); \
38 }
39
40 #define VG_MIN( A, B ) ((A)<(B)?(A):(B))
41 #define VG_MAX( A, B ) ((A)>(B)?(A):(B))
42 #define vg_list_size( A ) (sizeof(A)/sizeof(A[0]))