aboutsummaryrefslogtreecommitdiff
path: root/include/u.h
blob: 28bc2e4bef91f2d01e5ce7818127aabcadec1c54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once

// ------------------------------------------------------------------------
// Freestanding headers

#include <stdarg.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <float.h>
#include <limits.h>

// ------------------------------------------------------------------------
// Modern type aliases

typedef char          byte;
typedef unsigned char ubyte;
typedef signed char   sbyte;

typedef long long           vlong;
typedef unsigned long long  uvlong;

typedef unsigned int uint;
typedef uint8_t  uint8;
typedef uint16_t uint16;
typedef uint32_t uint32;
typedef uint64_t uint64;

typedef int8_t  int8;
typedef int16_t int16;
typedef int32_t int32;
typedef int64_t int64;

typedef float  float32;
typedef double float64;

typedef uintptr_t uintptr;
typedef intptr_t  intptr;

typedef int error;

typedef void* Iface;

#define nil NULL

// ------------------------------------------------------------------
// Global macros

#ifdef RELEASE
#define Assert(x)
#else
#define Assert(x) assert(x)
#endif

#define arrlen(Array) (sizeof(Array) / sizeof((Array)[0]))

#define MAX(x, y) ((x) >= (y) ? (x) : (y))
#define MIN(x, y) ((x) < (y) ? (x) : (y))