MCPcopy Create free account
hub / github.com/Bitrue-exchange/libada-go / VariableNatEncode

Function VariableNatEncode

pointer_address.go:22–33  ·  view source on GitHub ↗
(n uint64)

Source from the content-addressed store, hash-verified

20}
21
22func VariableNatEncode(n uint64) []byte {
23 o := []byte{byte(n) & 0x7f}
24 n /= 128
25 for n > 0 {
26 o = append(o, byte(n&0x7f)|0x80)
27 n /= 128
28 }
29 for i, j := 0, len(o)-1; i < j; i, j = i+1, j-1 {
30 o[i], o[j] = o[j], o[i]
31 }
32 return o
33}
34
35func VariableNatDecode(bytes []byte) (uint64, int, bool) {
36 var output uint64

Callers 2

TestVariableNatDecodeFunction · 0.85
BytesMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestVariableNatDecodeFunction · 0.68