MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / AppendUint64

Function AppendUint64

pkg/util/byteutil/byteutil.go:120–137  ·  view source on GitHub ↗

AppendUint64 appends v to dst using little endian binary encoding using at most byteCount bytes.

(dst []byte, v uint64, byteCount uint8)

Source from the content-addressed store, hash-verified

118
119// AppendUint64 appends v to dst using little endian binary encoding using at most byteCount bytes.
120func AppendUint64(dst []byte, v uint64, byteCount uint8) []byte {
121 switch byteCount {
122 case 0, 1, 2, 3, 4:
123 return AppendUint32(dst, uint32(v), byteCount)
124 case 5:
125 return append(dst, byte(v), byte(v>>8), byte(v>>16), byte(v>>24), byte(v>>32))
126 case 6:
127 return append(dst, byte(v), byte(v>>8), byte(v>>16), byte(v>>24), byte(v>>32), byte(v>>40))
128 case 7:
129 return append(dst, byte(v), byte(v>>8), byte(v>>16), byte(v>>24), byte(v>>32), byte(v>>40), byte(v>>48))
130 default:
131 dst = append(dst, byte(v), byte(v>>8), byte(v>>16), byte(v>>24), byte(v>>32), byte(v>>40), byte(v>>48), byte(v>>56))
132 for i := uint8(8); i < byteCount; i++ {
133 dst = append(dst, 0)
134 }
135 return dst
136 }
137}

Callers 2

mac.goFile · 0.92

Calls 1

AppendUint32Function · 0.85

Tested by

no test coverage detected