common/math: add BigIntToUint256Int method back

This commit is contained in:
Manav Darji 2025-03-25 23:51:56 +05:30
parent 8bb1e67330
commit 4a4ba278dc
No known key found for this signature in database
GPG key ID: A426F0124435F36E

View file

@ -20,6 +20,8 @@ package math
import (
"fmt"
"math/big"
"github.com/holiman/uint256"
)
// Various big integer limit values.
@ -194,3 +196,9 @@ func U256(x *big.Int) *big.Int {
func U256Bytes(n *big.Int) []byte {
return PaddedBigBytes(U256(n), 32)
}
// BigIntToUint256Int converts big Int to uint256 Int by setting bytes representing
// big-endian unsigned integer.
func BigIntToUint256Int(x *big.Int) *uint256.Int {
return new(uint256.Int).SetBytes(x.Bytes())
}