Bitcoin ABC  0.29.12
P2P Digital Currency
Functions | Variables
serialize_intcode.h File Reference
#include <crypto/common.h>
#include <serialize.h>
#include <tinyformat.h>
#include <cstdint>
#include <ios>
Include dependency graph for serialize_intcode.h:

Go to the source code of this file.

Functions

template<typename Stream >
void WriteIntcode (Stream &os, uint64_t value)
 Write a 64-bit integer in intcode encoding: More...
 
template<typename Stream >
uint64_t ReadIntcode (Stream &is)
 Read a 64-bit integer as intcode, see WriteIntcode. More...
 

Variables

const uint64_t VALID_RANGE []
 

Function Documentation

◆ ReadIntcode()

template<typename Stream >
uint64_t ReadIntcode ( Stream &  is)

Read a 64-bit integer as intcode, see WriteIntcode.

Specification & rationale can be found here: https://ecashbuilders.notion.site/eCash-Mitra-Integer-Encoding-Spec-2ff596494dcf4d12b75c763464df39de?pvs=4

Definition at line 84 of file serialize_intcode.h.

Here is the call graph for this function:

◆ WriteIntcode()

template<typename Stream >
void WriteIntcode ( Stream &  os,
uint64_t  value 
)

Write a 64-bit integer in intcode encoding:

Similar to UTF-8, except data bytes don't have a 10xx'xxxx prefix

Specification & rationale can be found here: https://ecashbuilders.notion.site/eCash-Mitra-Integer-Encoding-Spec-2ff596494dcf4d12b75c763464df39de?pvs=4

Examples: 0x0000'0000'0000'007f (7) -> "7f" 0x0000'0000'0000'3fff (14) -> "bfff" 0x0000'0000'001f'ffff (21) -> "dfffff" 0x0000'0000'0fff'ffff (28) -> "efffffff" 0x0000'0007'ffff'ffff (35) -> "f7ffffffff" 0x0000'03ff'ffff'ffff (42) -> "fbffffffffff" 0x0001'ffff'ffff'ffff (49) -> "fdffffffffffff" 0x00ff'ffff'ffff'ffff (56) -> "feffffffffffffff" 0xffff'ffff'ffff'ffff (63) -> "ffffffffffffffffff"

Definition at line 46 of file serialize_intcode.h.

Here is the call graph for this function:

Variable Documentation

◆ VALID_RANGE

const uint64_t VALID_RANGE[]
Initial value:
= {
0,
0x80,
0x4000,
0x20'0000,
0x1000'0000,
0x08'0000'0000,
0x0400'0000'0000,
0x02'0000'0000'0000,
0x0100'0000'0000'0000,
}

Definition at line 15 of file serialize_intcode.h.