Enforce int and short to be 32- and 16-bit respectively
Reactor's 'Int' type is specified to be 32-bit, always, and it was
implicitly assumed the C++ 'int' type has the same size. Likewise for
'short' being 16-bit.
Make this assumption explicit with static asserts.
Bug: b/145913083
Change-Id: Ie47346358487f8152f68654b75ea44b5d4f8823b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39129
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Reactor/Nucleus.hpp b/src/Reactor/Nucleus.hpp
index 50e27ad..25c933d 100644
--- a/src/Reactor/Nucleus.hpp
+++ b/src/Reactor/Nucleus.hpp
@@ -23,9 +23,12 @@
#include <vector>
#ifdef None
-#undef None // b/127920555
+#undef None // TODO(b/127920555)
#endif
+static_assert(sizeof(short) == 2, "Reactor's 'Short' type is 16-bit, and requires the C++ 'short' to match that.");
+static_assert(sizeof(int) == 4, "Reactor's 'Int' type is 32-bit, and requires the C++ 'int' to match that.");
+
namespace rr
{
class Type;