LispBM
Loading...
Searching...
No Matches
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
28extern "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
44typedef uint32_t lbm_value;
46typedef uint32_t lbm_type;
47
48typedef uint32_t lbm_uint;
49typedef int32_t lbm_int;
50typedef float lbm_float;
51typedef 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
64typedef int32_t lbm_cid;
65
66#else
70typedef uint64_t lbm_value;
72typedef uint64_t lbm_type;
73
74typedef uint64_t lbm_uint;
75typedef int64_t lbm_int;
76
77typedef float lbm_float;
78typedef 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
94typedef int64_t lbm_cid;
95#endif
96
97#ifdef __cplusplus
98}
99#endif
100#endif
int32_t lbm_cid
Definition lbm_types.h:64
int32_t lbm_int
Definition lbm_types.h:49
double lbm_double
Definition lbm_types.h:51
uint32_t lbm_uint
Definition lbm_types.h:48
float lbm_float
Definition lbm_types.h:50
uint32_t lbm_type
Definition lbm_types.h:46
uint32_t lbm_value
Definition lbm_types.h:44