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

Function AppendUint32

pkg/util/byteutil/byteutil.go:104–117  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

102
103// AppendUint32 appends v to dst using little endian binary encoding using at most byteCount bytes.
104func AppendUint32(dst []byte, v uint32, byteCount uint8) []byte {
105 switch byteCount {
106 case 0, 1, 2:
107 return AppendUint16(dst, uint16(v), byteCount)
108 case 3:
109 return append(dst, byte(v), byte(v>>8), byte(v>>16))
110 default:
111 dst = append(dst, byte(v), byte(v>>8), byte(v>>16), byte(v>>24))
112 for i := uint8(4); i < byteCount; i++ {
113 dst = append(dst, 0)
114 }
115 return dst
116 }
117}
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 {

Callers 7

mac.goFile · 0.92
AppendFHDRFunction · 0.92
AppendCFListFunction · 0.92
marshalBinaryEnumFunction · 0.92
AppendUint64Function · 0.85

Calls 1

AppendUint16Function · 0.85

Tested by

no test coverage detected