From f2246516ea68da5cd43bfd2b580c77923c96d3f5 Mon Sep 17 00:00:00 2001 From: Jose Martins Date: Sat, 30 Sep 2023 19:59:55 +0100 Subject: [PATCH] feat(types): unsigned long width sanity check Signed-off-by: Jose Martins --- src/core/inc/types.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/inc/types.h b/src/core/inc/types.h index 4ad439410..06de1dd37 100644 --- a/src/core/inc/types.h +++ b/src/core/inc/types.h @@ -11,6 +11,16 @@ #include #include +/** + * We assume LP64 and ILP32 for 64- and 32-bit architectures, respectively, as + * throughout the code `unsigned long` is the type used for values of the + * architecture's word width. This is just a sanity check to verify this is the + * ABI the compiler is effectively using. + */ +#if UINTPTR_WIDTH != ULONG_WIDTH +#error "Unsigned long type width is not the same as the architecture´s word with" +#endif + typedef signed long ssize_t; typedef unsigned long asid_t;