aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2020-03-24 10:46:18 -0400
committerJack Lloyd <[email protected]>2020-03-24 10:47:55 -0400
commit58bc946e8e3b6eebf46d513a570b6f5b1ffddeef (patch)
tree41133b242119fac8ac9c9811b3b3a4970839b8db
parent21303bf8000d93ac856452674d71d6b880e1b93f (diff)
Assert the length of size_t
C++11 just says that size_t is at least 16 bits but doesn't make any other specifications. Since we have only tested with 4 or 8, add a static_assert to catch weird platforms.
-rw-r--r--src/lib/utils/types.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/utils/types.h b/src/lib/utils/types.h
index 7f101735d..5cb48a3f6 100644
--- a/src/lib/utils/types.h
+++ b/src/lib/utils/types.h
@@ -100,6 +100,13 @@ using s32bit = std::int32_t;
#error BOTAN_MP_WORD_BITS must be 32 or 64
#endif
+/*
+* Should this assert fail on your system please contact the developers
+* for assistance in porting.
+*/
+static_assert(sizeof(std::size_t) == 8 || sizeof(std::size_t) == 4,
+ "This platform has an unexpected size for size_t");
+
}
#endif