diff options
author | Antoine Poinsot <darosior@protonmail.com> | 2023-10-06 11:35:15 +0200 |
---|---|---|
committer | Antoine Poinsot <darosior@protonmail.com> | 2023-10-08 02:43:17 +0200 |
commit | 9cb4c68b89a5715f82026f4aa446b876addd8472 (patch) | |
tree | 97f314a3d7526fdcfd8799abab18f740dfcc2e72 /src/serialize.h | |
parent | 892436c7d575ffdb9bada5fe4e62d6c1f5053c42 (diff) |
serialize: make GetSizeOfCompactSize constexpr
Diffstat (limited to 'src/serialize.h')
-rw-r--r-- | src/serialize.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/serialize.h b/src/serialize.h index e53ff9fa4c..8b15178ec0 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -316,7 +316,7 @@ template <typename Stream> inline void Unserialize(Stream& s, bool& a) { uint8_t * size <= UINT_MAX -- 5 bytes (254 + 4 bytes) * size > UINT_MAX -- 9 bytes (255 + 8 bytes) */ -inline unsigned int GetSizeOfCompactSize(uint64_t nSize) +constexpr inline unsigned int GetSizeOfCompactSize(uint64_t nSize) { if (nSize < 253) return sizeof(unsigned char); else if (nSize <= std::numeric_limits<uint16_t>::max()) return sizeof(unsigned char) + sizeof(uint16_t); |