Horizon Official Technical Documentation
Definitions.hpp
Go to the documentation of this file.
1/***************************************************
2 * _ _ _ *
3 * | | | | (_) *
4 * | |_| | ___ _ __ _ _______ _ __ *
5 * | _ |/ _ \| '__| |_ / _ \| '_ \ *
6 * | | | | (_) | | | |/ / (_) | | | | *
7 * \_| |_/\___/|_| |_/___\___/|_| |_| *
8 ***************************************************
9 * This file is part of Horizon (c).
10 * Copyright (c) 2019 Sagun K. (sagunxp@gmail.com).
11 * Copyright (c) 2019 Horizon Dev Team.
12 *
13 * Base Author - Sagun K. (sagunxp@gmail.com)
14 *
15 * This library is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation, either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this library. If not, see <http://www.gnu.org/licenses/>.
27 **************************************************/
28
29#ifndef HORIZON_DEFINITIONS_H
30#define HORIZON_DEFINITIONS_H
31
32#include <cstdint>
33
34typedef int64_t int64;
35typedef int32_t int32;
36typedef int16_t int16;
37typedef int8_t int8;
38typedef uint64_t uint64;
39typedef uint32_t uint32;
40typedef uint16_t uint16;
41typedef uint8_t uint8;
42
43
44// ILP64 isn't supported, so always 32 bits?
45#ifndef UINT_MAX
46#define UINT_MAX 0xffffffff
47#endif
48
49#undef UINT8_MIN
50#undef UINT16_MIN
51#undef UINT32_MIN
52#undef UINT64_MIN
53#define UINT8_MIN ((uint8) UINT8_C(0x00))
54#define UINT16_MIN ((uint16) UINT16_C(0x0000))
55#define UINT32_MIN ((uint32) UINT32_C(0x00000000))
56#define UINT64_MIN ((uint64) UINT64_C(0x0000000000000000))
57
58#undef UINT8_MAX
59#undef UINT16_MAX
60#undef UINT32_MAX
61#undef UINT64_MAX
62#define UINT8_MAX ((uint8) UINT8_C(0xFF))
63#define UINT16_MAX ((uint16) UINT16_C(0xFFFF))
64#define UINT32_MAX ((uint32) UINT32_C(0xFFFFFFFF))
65#define UINT64_MAX ((uint64) UINT64_C(0xFFFFFFFFFFFFFFFF))
66
67#undef SINT8_MIN
68#undef SINT16_MIN
69#undef SINT32_MIN
70#undef SINT64_MIN
71#define SINT8_MIN ((sint8) INT8_C(0x80))
72#define SINT16_MIN ((sint16) INT16_C(0x8000))
73#define SINT32_MIN ((sint32) INT32_C(0x80000000))
74#define SINT64_MIN ((sint32) INT64_C(0x8000000000000000))
75
76#undef SINT8_MAX
77#undef SINT16_MAX
78#undef SINT32_MAX
79#undef SINT64_MAX
80#define SINT8_MAX ((sint8) INT8_C(0x7F))
81#define SINT16_MAX ((sint16) INT16_C(0x7FFF))
82#define SINT32_MAX ((sint32) INT32_C(0x7FFFFFFF))
83#define SINT64_MAX ((sint64) INT64_C(0x7FFFFFFFFFFFFFFF))
84
85#endif //HORIZON_DEFINITIONS_H
uint8_t uint8
Definition: Definitions.hpp:41
int64_t int64
Definition: Definitions.hpp:34
int16_t int16
Definition: Definitions.hpp:36
int8_t int8
Definition: Definitions.hpp:37
int32_t int32
Definition: Definitions.hpp:35
uint64_t uint64
Definition: Definitions.hpp:38
uint16_t uint16
Definition: Definitions.hpp:40
uint32_t uint32
Definition: Definitions.hpp:39