8#ifndef BITCOIN_COMPAT_ASSUMPTIONS_H
9#define BITCOIN_COMPAT_ASSUMPTIONS_H
21#error "Bitcoin cannot be compiled without assertions."
30static_assert(
__cplusplus >= 201703L,
"C++17 standard assumed");
37static_assert(std::numeric_limits<float>::is_iec559,
"IEEE 754 float assumed");
38static_assert(std::numeric_limits<double>::is_iec559,
39 "IEEE 754 double assumed");
44static_assert(
sizeof(
float) == 4,
"32-bit float assumed");
45static_assert(
sizeof(
double) == 8,
"64-bit double assumed");
50static_assert(
sizeof(
short) == 2,
"16-bit short assumed");
51static_assert(
sizeof(
int) == 4,
"32-bit int assumed");
52static_assert(
sizeof(
unsigned) == 4,
"32-bit unsigned assumed");
56static_assert(
CHAR_BIT == 8,
"8-bit bytes assumed");
67static_assert(std::is_same<uint8_t, unsigned char>::value,
68 "uint8_t is an alias of unsigned char");
74static_assert(
sizeof(
size_t) == 4 ||
sizeof(
size_t) == 8,
75 "size_t assumed to be 32-bit or 64-bit");
76static_assert(
sizeof(
size_t) ==
sizeof(
void *),
77 "Sizes of size_t and void* assumed to be equal");
95 "Arithmetic right shift assumed");
101static_assert((
int64_t(-10) & 0xffff) == 0xfff6,
"2-complement assumed");
106static_assert(std::numeric_limits<long long int>::max() ==
107 std::numeric_limits<int64_t>::max());
108static_assert(std::numeric_limits<long long int>::min() ==
109 std::numeric_limits<int64_t>::min());
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...