MCPcopy Index your code
hub / github.com/tinylib/msgp / EncodeMsg

Method EncodeMsg

msgp/number.go:197–210  ·  view source on GitHub ↗

EncodeMsg implements msgp.Encodable

(w *Writer)

Source from the content-addressed store, hash-verified

195
196// EncodeMsg implements msgp.Encodable
197func (n *Number) EncodeMsg(w *Writer) error {
198 switch n.typ {
199 case IntType:
200 return w.WriteInt64(int64(n.bits))
201 case UintType:
202 return w.WriteUint64(n.bits)
203 case Float64Type:
204 return w.WriteFloat64(math.Float64frombits(n.bits))
205 case Float32Type:
206 return w.WriteFloat32(math.Float32frombits(uint32(n.bits)))
207 default:
208 return w.WriteInt64(0)
209 }
210}
211
212// CoerceInt attempts to coerce the value of
213// the number into a signed integer and returns

Callers

nothing calls this directly

Calls 4

WriteInt64Method · 0.80
WriteUint64Method · 0.80
WriteFloat64Method · 0.80
WriteFloat32Method · 0.80

Tested by

no test coverage detected