summaryrefslogtreecommitdiff
path: root/tests/headers/default-macro-constant-type.h
diff options
context:
space:
mode:
authorAntoni Simka <antonisimka.8@gmail.com>2020-12-15 17:18:16 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2020-12-19 19:28:24 +0100
commitea4164c85c6a305379e4cc70465aae15afedf3d7 (patch)
tree323ccce6f23f3dfe02c6100a009d970f5129653c /tests/headers/default-macro-constant-type.h
parent112c69129163ea3139de019328cd8e4b837e530f (diff)
Add option to fit macro consts into smaller types
Add a `--fit-macro-constant-types` option to make bindgen try to fit macro integer constants into types smaller than u32/i32. Useful especially when dealing with 8/16-bit architectures. Closes #1945
Diffstat (limited to 'tests/headers/default-macro-constant-type.h')
-rw-r--r--tests/headers/default-macro-constant-type.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/headers/default-macro-constant-type.h b/tests/headers/default-macro-constant-type.h
index d11941b4..a863362c 100644
--- a/tests/headers/default-macro-constant-type.h
+++ b/tests/headers/default-macro-constant-type.h
@@ -8,6 +8,24 @@
#define N_1 (-1LL)
#define N_2 (-2LL)
+#define MAX_U16 0xFFFFULL
+#define MAX_I16 (0x8000ULL - 1)
+
+#define MAX_I16_Plus1 (MAX_I16 + 1)
+#define MAX_U16_Plus1 (MAX_U16 + 1)
+
+#define MAX_I16_Minus1 (MAX_I16 - 1)
+#define MAX_U16_Minus1 (MAX_U16 - 1)
+
+#define MIN_U16 0
+#define MIN_I16 (- (1ULL<<15))
+
+#define MIN_U16_Plus1 (MIN_U16 + 1)
+#define MIN_I16_Plus1 (MIN_I16 + 1)
+
+#define MIN_U16_Minus1 (MIN_U16 - 1)
+#define MIN_I16_Minus1 (MIN_I16 - 1)
+
#define MAX_U32 0xFFFFFFFFULL
#define MAX_I32 (0x80000000ULL - 1)