EncodeMsg implements msgp.Encodable
(w *Writer)
| 195 | |
| 196 | // EncodeMsg implements msgp.Encodable |
| 197 | func (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 |
nothing calls this directly
no test coverage detected