aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/common/types.h
blob: 921a327f54607c6d91c971f7953bd7e242175737 (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
#ifndef __JE_TYPES_H__
#define __JE_TYPES_H__
#include <stdint.h>
#include <stdlib.h>
#include <cstring>

namespace JinEngine
{

	typedef int8_t   int8;   ///< Signed integer with a size of 8 bits. Supports values from -128 to 127
	typedef uint8_t  uint8;  ///< Unsigned integer with a size of 8 bits. Supports values from 0 to 255.
	typedef uint8	byte;   ///< Unsigned integer with 8 bits (1 byte). Supports 256 values from 0 to 255.
	typedef int16_t  int16;  ///< Signed integer with a size of 16 bits. Supports values from -32768 to 32767
	typedef uint16_t uint16; ///< Unsigned integer with a size of 16 bits. Supports values from 0 to 65535.
	typedef int32_t  int32;  ///< Signed integer with a size of 32 bits. Supports values from -2147483648 to 2147483647.
	typedef uint32_t uint32; ///< Unsigned integer with a size of 32 bits. Supports values from 0 to 4294967295, (2^32 - 1).
	typedef int64_t  int64;  ///< Signed integer with a size of 64 bits. Supports values from -(2^63) to (2^63 - 1).
	typedef uint64_t uint64; ///< Unsigned integer with a size of 64 bits, Supports values from 0 to (2^64 - 1).

	typedef uint32_t uint;
	typedef int32_t  sint;

#define Union(name, ...) \
union _Ctor{									\
	_Ctor() { memset(this, 0, sizeof(*this)); } \
	__VA_ARGS__;								\
} name;

#define Struct(name, ...) \
struct {__VA_ARGS__;} name;

}

#endif