Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions interpreter/value_fix64.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ func (v Fix64Value) Div(context NumberValueArithmeticContext, other NumberValue,

valueGetter := func() int64 {
result := new(big.Int).Mul(a, sema.Fix64FactorBig)
result.Div(result, b)
result.Quo(result, b)

if result.Cmp(minInt64Big) < 0 {
panic(&UnderflowError{
Expand Down Expand Up @@ -362,7 +362,7 @@ func (v Fix64Value) SaturatingDiv(context NumberValueArithmeticContext, other Nu

valueGetter := func() int64 {
result := new(big.Int).Mul(a, sema.Fix64FactorBig)
result.Div(result, b)
result.Quo(result, b)

if result.Cmp(minInt64Big) < 0 {
return math.MinInt64
Expand Down
4 changes: 2 additions & 2 deletions interpreter/value_int128.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ func (v Int128Value) Div(context NumberValueArithmeticContext, other NumberValue
LocationRange: locationRange,
})
}
res.Div(v.BigInt, o.BigInt)
res.Quo(v.BigInt, o.BigInt)

return res
}
Expand Down Expand Up @@ -495,7 +495,7 @@ func (v Int128Value) SaturatingDiv(context NumberValueArithmeticContext, other N
if (v.BigInt.Cmp(sema.Int128TypeMinIntBig) == 0) && (o.BigInt.Cmp(res) == 0) {
return sema.Int128TypeMaxIntBig
}
res.Div(v.BigInt, o.BigInt)
res.Quo(v.BigInt, o.BigInt)

return res
}
Expand Down
4 changes: 2 additions & 2 deletions interpreter/value_int256.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ func (v Int256Value) Div(context NumberValueArithmeticContext, other NumberValue
LocationRange: locationRange,
})
}
res.Div(v.BigInt, o.BigInt)
res.Quo(v.BigInt, o.BigInt)
return res
}

Expand Down Expand Up @@ -463,7 +463,7 @@ func (v Int256Value) SaturatingDiv(context NumberValueArithmeticContext, other N
if (v.BigInt.Cmp(sema.Int256TypeMinIntBig) == 0) && (o.BigInt.Cmp(res) == 0) {
return sema.Int256TypeMaxIntBig
}
res.Div(v.BigInt, o.BigInt)
res.Quo(v.BigInt, o.BigInt)
return res
}

Expand Down
2 changes: 1 addition & 1 deletion values/value_int.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (v IntValue) Div(gauge common.MemoryGauge, other IntValue) (IntValue, error
common.NewDivBigIntMemoryUsage(v.BigInt, other.BigInt),
func() *big.Int {
res := new(big.Int)
return res.Div(v.BigInt, other.BigInt)
return res.Quo(v.BigInt, other.BigInt)
},
), nil
}
Expand Down
Loading