vm: make NewBigInteger accept int64

It is more correct upconvert to int64 if needed,
so precision is never lost.
This commit is contained in:
Evgenii Stratonikov 2020-03-24 11:06:26 +03:00
parent 5148b98f43
commit dc8fb13021
2 changed files with 3 additions and 3 deletions

View file

@ -434,7 +434,7 @@ func parseArgs(args []string) ([]vm.StackItem, error) {
return nil, errors.New("failed to parse bool parameter")
}
case intType:
val, err := strconv.Atoi(value)
val, err := strconv.ParseInt(value, 10, 64)
if err != nil {
return nil, err
}

View file

@ -191,9 +191,9 @@ type BigIntegerItem struct {
}
// NewBigIntegerItem returns an new BigIntegerItem object.
func NewBigIntegerItem(value int) *BigIntegerItem {
func NewBigIntegerItem(value int64) *BigIntegerItem {
return &BigIntegerItem{
value: big.NewInt(int64(value)),
value: big.NewInt(value),
}
}