Int64 calls (big.Int).Int64.
()
| 590 | |
| 591 | // Int64 calls (big.Int).Int64. |
| 592 | func (z *BigInt) Int64() int64 { |
| 593 | if zVal, zNeg, ok := z.innerAsUint64(); ok { |
| 594 | // The unchecked cast from uint64 to int64 looks unsafe, but it is |
| 595 | // allowed and is identical to the logic in (big.Int).Int64. Per the |
| 596 | // method's contract: |
| 597 | // > If z cannot be represented in an int64, the result is undefined. |
| 598 | zi := int64(zVal) |
| 599 | if zNeg { |
| 600 | zi = -zi |
| 601 | } |
| 602 | return zi |
| 603 | } |
| 604 | var tmp1 big.Int //gcassert:noescape |
| 605 | return z.inner(&tmp1).Int64() |
| 606 | } |
| 607 | |
| 608 | // IsInt64 calls (big.Int).IsInt64. |
| 609 | func (z *BigInt) IsInt64() bool { |