vm: make NewBigInteger accept int64
It is more correct upconvert to int64 if needed, so precision is never lost.
This commit is contained in:
parent
5148b98f43
commit
dc8fb13021
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue