[General] Ensure primitive type sizes

This commit is contained in:
momo5502 2017-04-16 12:31:16 +02:00
parent 6f72458a40
commit ee466a26bc

View File

@ -33,16 +33,24 @@ AssertSize(uint64_t, 8);
AssertSize(std::int64_t, 8);
AssertSize(std::uint64_t, 8);
// 64 bit double precision floating point numbers
AssertSize(double, 8);
// 32 bit integers
AssertSize(__int32, 4);
AssertSize(unsigned __int32, 4);
AssertSize(int, 4);
AssertSize(unsigned int, 4);
AssertSize(long, 4);
AssertSize(unsigned long, 4);
AssertSize(int32_t, 4);
AssertSize(uint32_t, 4);
AssertSize(std::int32_t, 4);
AssertSize(std::uint32_t, 4);
// 32 bit single precision floating point numbers
AssertSize(float, 4);
// 16 bit integers
AssertSize(__int16, 2);
AssertSize(unsigned __int16, 2);
@ -65,7 +73,9 @@ AssertSize(std::int8_t, 1);
AssertSize(std::uint8_t, 1);
// Ensure pointers are 4 bytes in size (32-bit)
// ReSharper disable CppRedundantBooleanExpressionArgument
static_assert(sizeof(intptr_t) == 4 && sizeof(void*) == 4 && sizeof(size_t) == 4, "This doesn't seem to be a 32-bit environment!");
// ReSharper restore CppRedundantBooleanExpressionArgument
#if !defined(_M_IX86)
#error "Invalid processor achritecture!"