AsInt sets the number to an int64.
(i int64)
| 30 | |
| 31 | // AsInt sets the number to an int64. |
| 32 | func (n *Number) AsInt(i int64) { |
| 33 | // we always store int(0) |
| 34 | // as {0, InvalidType} in |
| 35 | // order to preserve |
| 36 | // the behavior of the == operator |
| 37 | if i == 0 { |
| 38 | n.typ = InvalidType |
| 39 | n.bits = 0 |
| 40 | return |
| 41 | } |
| 42 | |
| 43 | n.typ = IntType |
| 44 | n.bits = uint64(i) |
| 45 | } |
| 46 | |
| 47 | // AsUint sets the number to a uint64. |
| 48 | func (n *Number) AsUint(u uint64) { |
no outgoing calls