Changeset View
Changeset View
Standalone View
Standalone View
src/compat/assumptions.h
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
static_assert(sizeof(float) == 4, "32-bit float assumed"); | static_assert(sizeof(float) == 4, "32-bit float assumed"); | ||||
static_assert(sizeof(double) == 8, "64-bit double assumed"); | static_assert(sizeof(double) == 8, "64-bit double assumed"); | ||||
// Assumption: We assume integer widths. | // Assumption: We assume integer widths. | ||||
// Example(s): GetSizeOfCompactSize and WriteCompactSize in the serialization | // Example(s): GetSizeOfCompactSize and WriteCompactSize in the serialization | ||||
// code. | // code. | ||||
static_assert(sizeof(short) == 2, "16-bit short assumed"); | static_assert(sizeof(short) == 2, "16-bit short assumed"); | ||||
static_assert(sizeof(int) == 4, "32-bit int assumed"); | static_assert(sizeof(int) == 4, "32-bit int assumed"); | ||||
static_assert(sizeof(unsigned) == 4, "32-bit unsigned assumed"); | |||||
// Assumption: We assume 8-bit bytes, because 32-bit int and 16-bit short are | // Assumption: We assume 8-bit bytes, because 32-bit int and 16-bit short are | ||||
// assumed. | // assumed. | ||||
static_assert(CHAR_BIT == 8, "8-bit bytes assumed"); | static_assert(CHAR_BIT == 8, "8-bit bytes assumed"); | ||||
// Assumption: We assume uint8_t is an alias of unsigned char. | // Assumption: We assume uint8_t is an alias of unsigned char. | ||||
// char, unsigned char, and std::byte (C++17) are the only "byte types" | // char, unsigned char, and std::byte (C++17) are the only "byte types" | ||||
// according to the C++ Standard. "byte type" means a type that can be used to | // according to the C++ Standard. "byte type" means a type that can be used to | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |