MCPcopy Create free account
hub / github.com/cockroachdb/apd / Int64

Method Int64

bigint.go:592–606  ·  view source on GitHub ↗

Int64 calls (big.Int).Int64.

()

Source from the content-addressed store, hash-verified

590
591// Int64 calls (big.Int).Int64.
592func (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.
609func (z *BigInt) IsInt64() bool {

Callers 6

TestBigInt64Function · 0.95
TestBigIntSqrtFunction · 0.45
TestInt64Function · 0.45
TestCeilFunction · 0.45
TestFloorFunction · 0.45

Calls 2

innerAsUint64Method · 0.95
innerMethod · 0.95

Tested by 6

TestBigInt64Function · 0.76
TestBigIntSqrtFunction · 0.36
TestInt64Function · 0.36
TestCeilFunction · 0.36
TestFloorFunction · 0.36