Unverified Commit a90e645c authored by Marius van der Wijden's avatar Marius van der Wijden Committed by GitHub

mobile: added constructor for big int (#21597)

* mobile: added constructor for big int

* mobile: tiny nitpick
parent 420b7865
......@@ -35,6 +35,16 @@ func NewBigInt(x int64) *BigInt {
return &BigInt{big.NewInt(x)}
}
// NewBigIntFromString allocates and returns a new BigInt set to x
// interpreted in the provided base.
func NewBigIntFromString(x string, base int) *BigInt {
b, success := new(big.Int).SetString(x, base)
if !success {
return nil
}
return &BigInt{b}
}
// GetBytes returns the absolute value of x as a big-endian byte slice.
func (bi *BigInt) GetBytes() []byte {
return bi.bigint.Bytes()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment