MCPcopy Index your code
hub / github.com/vmihailenco/msgpack / EncodeUint

Method EncodeUint

encode_number.go:108–122  ·  view source on GitHub ↗

EncodeUnsignedNumber encodes an uint64 in 1, 2, 3, 5, or 9 bytes. Type of the number is lost during encoding.

(n uint64)

Source from the content-addressed store, hash-verified

106// EncodeUnsignedNumber encodes an uint64 in 1, 2, 3, 5, or 9 bytes.
107// Type of the number is lost during encoding.
108func (e *Encoder) EncodeUint(n uint64) error {
109 if n <= math.MaxInt8 {
110 return e.w.WriteByte(byte(n))
111 }
112 if n <= math.MaxUint8 {
113 return e.EncodeUint8(uint8(n))
114 }
115 if n <= math.MaxUint16 {
116 return e.EncodeUint16(uint16(n))
117 }
118 if n <= math.MaxUint32 {
119 return e.EncodeUint32(uint32(n))
120 }
121 return e.EncodeUint64(n)
122}
123
124// EncodeNumber encodes an int64 in 1, 2, 3, 5, or 9 bytes.
125// Type of the number is lost during encoding.

Callers 7

encodeUint8CondMethod · 0.95
encodeUint16CondMethod · 0.95
encodeUint32CondMethod · 0.95
encodeUint64CondMethod · 0.95
EncodeIntMethod · 0.95
EncodeMethod · 0.95
encodeUintValueFunction · 0.80

Calls 5

EncodeUint8Method · 0.95
EncodeUint16Method · 0.95
EncodeUint32Method · 0.95
EncodeUint64Method · 0.95
WriteByteMethod · 0.65

Tested by

no test coverage detected