-
Notifications
You must be signed in to change notification settings - Fork 5
/
types.h
58 lines (48 loc) · 924 Bytes
/
types.h
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
#ifndef TYPES_H
#define TYPES_H
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef enum
{
INTEGER_SUFFIX_NONE,
INTEGER_SUFFIX_LONG,
INTEGER_SUFFIX_LONG_LONG,
INTEGER_SUFFIX_SIZE
} integer_suffix_t;
typedef struct
{
union
{
i64 value;
u64 unsigned_value;
};
bool is_unsigned;
integer_suffix_t suffix;
} integer_t;
typedef enum
{
SCALAR_SUFFIX_NONE,
SCALAR_SUFFIX_FLOAT,
SCALAR_SUFFIX_LONG_DOUBLE
} scalar_suffix_t;
typedef struct
{
long double value;
scalar_suffix_t suffix;
} scalar_t;
#ifdef __GNUC__
#define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__))
#endif
#ifdef _MSC_VER
#define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop))
#endif
#endif