diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2019-03-04 11:03:50 +0100 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2019-03-04 14:15:58 +0100 |
commit | c7ea8d3236e7c1b0c198345cc78a6754338d3724 (patch) | |
tree | 7519c87eec8def47793abb7c89a0fa74b0ff3b31 | |
parent | 2d46f1be0c3c8b7287aa1f62bb1f5b4a8d00ff6e (diff) |
Add sizeof(size_t) assumptions
-rw-r--r-- | src/compat/assumptions.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compat/assumptions.h b/src/compat/assumptions.h index 820c9b93d9..0d39f66dbd 100644 --- a/src/compat/assumptions.h +++ b/src/compat/assumptions.h @@ -40,8 +40,13 @@ static_assert(sizeof(double) == 8, "64-bit double assumed"); static_assert(sizeof(short) == 2, "16-bit short assumed"); static_assert(sizeof(int) == 4, "32-bit int assumed"); +// Assumption: We assume size_t to be 32-bit or 64-bit. +// Example(s): size_t assumed to be at least 32-bit in ecdsa_signature_parse_der_lax(...). +// size_t assumed to be 32-bit or 64-bit in MallocUsage(...). +static_assert(sizeof(size_t) == 4 || sizeof(size_t) == 8, "size_t assumed to be 32-bit or 64-bit"); +static_assert(sizeof(size_t) == sizeof(void*), "Sizes of size_t and void* assumed to be equal"); + // Some important things we are NOT assuming (non-exhaustive list): -// * We are NOT assuming a specific value for sizeof(std::size_t). // * We are NOT assuming a specific value for std::endian::native. // * We are NOT assuming a specific value for std::locale("").name(). // * We are NOT assuming a specific value for std::numeric_limits<char>::is_signed. |