mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
mobile: Add Sign to mobile BigInt
Currently, the only way of getting the sign of a BigInt from mobile is coverting to string. This adds a Sign function to make conversion faster.
This commit is contained in:
parent
e4c9fd29a3
commit
e8b5f8b396
1 changed files with 10 additions and 0 deletions
|
|
@ -62,6 +62,16 @@ func (bi *BigInt) SetInt64(x int64) {
|
||||||
bi.bigint.SetInt64(x)
|
bi.bigint.SetInt64(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sign returns:
|
||||||
|
//
|
||||||
|
// -1 if x < 0
|
||||||
|
// 0 if x == 0
|
||||||
|
// +1 if x > 0
|
||||||
|
//
|
||||||
|
func (bi *BigInt) Sign() int {
|
||||||
|
return bi.bigint.Sign()
|
||||||
|
}
|
||||||
|
|
||||||
// SetString sets the big int to x.
|
// SetString sets the big int to x.
|
||||||
//
|
//
|
||||||
// The string prefix determines the actual conversion base. A prefix of "0x" or
|
// The string prefix determines the actual conversion base. A prefix of "0x" or
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue