forked from TrueCloudLab/neoneo-go
vm: implement BigInt -> Boolean conversion
This commit is contained in:
parent
33bb371f9b
commit
52b0d661e0
1 changed files with 5 additions and 0 deletions
|
@ -63,6 +63,11 @@ func (e *Element) BigInt() *big.Int {
|
|||
switch t := e.value.(type) {
|
||||
case *BigIntegerItem:
|
||||
return t.value
|
||||
case *BoolItem:
|
||||
if t.value {
|
||||
return big.NewInt(1)
|
||||
}
|
||||
return big.NewInt(0)
|
||||
default:
|
||||
b := t.Value().([]uint8)
|
||||
return new(big.Int).SetBytes(util.ArrayReverse(b))
|
||||
|
|
Loading…
Reference in a new issue