LispBM
lbm_types.h
Go to the documentation of this file.
1 
2 /*
3  Copyright 2019, 2022 Joel Svensson svenssonjoel@yahoo.se
4  Copyright 2024 Rasmus Söderhielm rasmus.soderhielm@gmail.com
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef LISPBM_TYPES_H_
21 #define LISPBM_TYPES_H_
22 
23 #include <stdint.h>
24 #include <stdbool.h>
25 #include <inttypes.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /* Addresses that are put into lbm_values or into
32  * lbm_memory must have this alignment. */
33 #ifndef LBM64
34 #define LBM_STORABLE_ADDRESS_ALIGNMENT 4
35 #else
36 #define LBM_STORABLE_ADDRESS_ALIGNMENT 8
37 #endif
38 
39 #ifndef LBM64
40 
44 typedef uint32_t lbm_value;
46 typedef uint32_t lbm_type;
47 
48 typedef uint32_t lbm_uint;
49 typedef int32_t lbm_int;
50 typedef float lbm_float;
51 typedef double lbm_double;
52 
53 #define LBM_UINT_MAX UINT32_MAX
54 #define LBM_INT_MIN INT32_MIN
55 #define LBM_INT_MAX INT32_MAX
56 
57 #define PRI_VALUE PRIu32
58 #define PRI_TYPE PRIu32
59 #define PRI_UINT PRIu32
60 #define PRI_INT PRId32
61 #define PRI_HEX PRIx32
62 #define PRI_FLOAT "f"
63 
64 typedef int32_t lbm_cid;
65 
66 #else
67 
70 typedef uint64_t lbm_value;
72 typedef uint64_t lbm_type;
73 
74 typedef uint64_t lbm_uint;
75 typedef int64_t lbm_int;
76 
77 typedef float lbm_float;
78 typedef double lbm_double;
79 
80 #define LBM_UINT_MAX UINT64_MAX
81 #define LBM_INT_MIN INT64_MIN
82 #define LBM_INT_MAX INT64_MAX
83 
84 #define PRI_VALUE PRIu64
85 #define PRI_TYPE PRIu64
86 #define PRI_UINT PRIu64
87 #define PRI_INT PRId64
88 #define PRI_HEX PRIx64
89 #define PRI_FLOAT "lf"
90 
94 typedef int64_t lbm_cid;
95 #endif
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 #endif
lbm_uint
uint32_t lbm_uint
Definition: lbm_types.h:48
lbm_double
double lbm_double
Definition: lbm_types.h:51
lbm_float
float lbm_float
Definition: lbm_types.h:50
lbm_value
uint32_t lbm_value
Definition: lbm_types.h:44
lbm_int
int32_t lbm_int
Definition: lbm_types.h:49
lbm_cid
int32_t lbm_cid
Definition: lbm_types.h:64
lbm_type
uint32_t lbm_type
Definition: lbm_types.h:46