Commit b3a473ed by Nicolas Capens Committed by Nicolas Capens

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: 's avatarAlexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 7a15cef2
...@@ -23,9 +23,12 @@ ...@@ -23,9 +23,12 @@
#include <vector> #include <vector>
#ifdef None #ifdef None
#undef None // b/127920555 #undef None // TODO(b/127920555)
#endif #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 namespace rr
{ {
class Type; class Type;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment