mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 23:07:59 +01:00
serialize: make GetSizeOfCompactSize constexpr
This commit is contained in:
parent
892436c7d5
commit
9cb4c68b89
1 changed files with 1 additions and 1 deletions
|
@ -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 -- 5 bytes (254 + 4 bytes)
|
||||||
* size > UINT_MAX -- 9 bytes (255 + 8 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);
|
if (nSize < 253) return sizeof(unsigned char);
|
||||||
else if (nSize <= std::numeric_limits<uint16_t>::max()) return sizeof(unsigned char) + sizeof(uint16_t);
|
else if (nSize <= std::numeric_limits<uint16_t>::max()) return sizeof(unsigned char) + sizeof(uint16_t);
|
||||||
|
|
Loading…
Add table
Reference in a new issue