* Compact Size * size < 253 -- 1 byte * size <= USHRT_MAX -- 3 bytes (253 + 2 bytes) * size <= UINT_MAX -- 5 bytes (254 + 4 bytes) * size > UINT_MAX -- 9 bytes (255 + 8 bytes) */
| 240 | * size > UINT_MAX -- 9 bytes (255 + 8 bytes) |
| 241 | */ |
| 242 | inline unsigned int GetSizeOfCompactSize(uint64_t nSize) |
| 243 | { |
| 244 | if (nSize < 253) return sizeof(unsigned char); |
| 245 | else if (nSize <= std::numeric_limits<unsigned short>::max()) return sizeof(unsigned char) + sizeof(unsigned short); |
| 246 | else if (nSize <= std::numeric_limits<unsigned int>::max()) return sizeof(unsigned char) + sizeof(unsigned int); |
| 247 | else return sizeof(unsigned char) + sizeof(uint64_t); |
| 248 | } |
| 249 | |
| 250 | inline void WriteCompactSize(CSizeComputer& os, uint64_t nSize); |
| 251 |
no test coverage detected