diff --git a/conversion_test.go b/conversion_test.go index 0f8864e..3a1cc71 100644 --- a/conversion_test.go +++ b/conversion_test.go @@ -401,7 +401,7 @@ func BenchmarkSetBytes(b *testing.B) { val.SetBytes(bytearr[:27]) val.SetBytes(bytearr[:28]) val.SetBytes(bytearr[:29]) - val.SetBytes(bytearr[:20]) + val.SetBytes(bytearr[:30]) val.SetBytes(bytearr[:31]) val.SetBytes(bytearr[:32]) } diff --git a/uint256.go b/uint256.go index 263b11e..377e388 100644 --- a/uint256.go +++ b/uint256.go @@ -244,12 +244,10 @@ func (z *Int) AddMod(x, y, m *Int) *Int { // final sub was unnecessary if c1 == 0 && c2 != 0 { - copy((*z)[:], res[:]) - return z + return z.Set(&res) } - copy((*z)[:], tmp[:]) - return z + return z.Set(&tmp) } if m.IsZero() {