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

Function AppendUint16

pkg/util/byteutil/byteutil.go:88–101  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

86
87// AppendUint16 appends v to dst using little endian binary encoding using at most byteCount bytes.
88func AppendUint16(dst []byte, v uint16, byteCount uint8) []byte {
89 switch byteCount {
90 case 0:
91 return dst
92 case 1:
93 return append(dst, byte(v))
94 default:
95 dst = append(dst, byte(v), byte(v>>8))
96 for i := uint8(2); i < byteCount; i++ {
97 dst = append(dst, 0)
98 }
99 return dst
100 }
101}
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 {

Callers 3

mac.goFile · 0.92
marshalBinaryEnumFunction · 0.92
AppendUint32Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected