NewCount32 initializes a Count32 from a uint64, capped at math.MaxUint32.
(n uint64)
| 10 | // NewCount32 initializes a Count32 from a uint64, capped at |
| 11 | // math.MaxUint32. |
| 12 | func NewCount32(n uint64) Count32 { |
| 13 | if n > math.MaxUint32 { |
| 14 | return Count32(math.MaxUint32) |
| 15 | } |
| 16 | return Count32(n) |
| 17 | } |
| 18 | |
| 19 | // ToUint64 returns the value of `n` as a `uint64`. If the value has |
| 20 | // overflowed, it returns `(math.MaxUint32, true)`. |