Skip to content

Commit

Permalink
all: go format
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Aug 27, 2021
1 parent 76e39aa commit e051979
Show file tree
Hide file tree
Showing 4 changed files with 432 additions and 246 deletions.
70 changes: 45 additions & 25 deletions benchmarks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,31 +645,51 @@ func BenchmarkAddMod(b *testing.B) {
residue256Big [len(int256Samples)]big.Int
)

for i := 0; i < len( int32Samples); i++ { residue32Int[i] = *(I.Mod( &int32Samples[i], &int32SamplesLt[i])) }
for i := 0; i < len( big32Samples); i++ { residue32Big[i] = *(B.Mod( &big32Samples[i], &big32SamplesLt[i])) }

for i := 0; i < len( int64Samples); i++ { residue64Int[i] = *(I.Mod( &int64Samples[i], &int64Samples[i])) }
for i := 0; i < len( big64Samples); i++ { residue64Big[i] = *(B.Mod( &big64Samples[i], &big64Samples[i])) }

for i := 0; i < len(int128Samples); i++ { residue128Int[i] = *(I.Mod(&int128Samples[i], &int128Samples[i])) }
for i := 0; i < len(big128Samples); i++ { residue128Big[i] = *(B.Mod(&big128Samples[i], &big128Samples[i])) }

for i := 0; i < len(int192Samples); i++ { residue192Int[i] = *(I.Mod(&int192Samples[i], &int192Samples[i])) }
for i := 0; i < len(big192Samples); i++ { residue192Big[i] = *(B.Mod(&big192Samples[i], &big192Samples[i])) }

for i := 0; i < len(int256Samples); i++ { residue256Int[i] = *(I.Mod(&int256Samples[i], &int256SamplesLt[i])) }
for i := 0; i < len(big256Samples); i++ { residue256Big[i] = *(B.Mod(&big256Samples[i], &big256SamplesLt[i])) }

b.Run("small/uint256", func(b *testing.B) { benchmarkAddModUint256 (b, &residue32Int, &int32SamplesLt) })
b.Run("small/big", func(b *testing.B) { benchmarkAddModBig (b, &residue32Big, &big32SamplesLt) })
b.Run("mod64/uint256", func(b *testing.B) { benchmarkAddModUint256 (b, &residue256Int, &int64Samples) })
b.Run("mod64/big", func(b *testing.B) { benchmarkAddModBig (b, &residue256Big, &big64Samples) })
b.Run("mod128/uint256", func(b *testing.B) { benchmarkAddModUint256 (b, &residue256Int, &int128Samples) })
b.Run("mod128/big", func(b *testing.B) { benchmarkAddModBig (b, &residue256Big, &big128Samples) })
b.Run("mod192/uint256", func(b *testing.B) { benchmarkAddModUint256 (b, &residue256Int, &int192Samples) })
b.Run("mod192/big", func(b *testing.B) { benchmarkAddModBig (b, &residue256Big, &big192Samples) })
b.Run("mod256/uint256", func(b *testing.B) { benchmarkAddModUint256 (b, &residue256Int, &int256SamplesLt) })
b.Run("mod256/big", func(b *testing.B) { benchmarkAddModBig (b, &residue256Big, &big256SamplesLt) })
for i := 0; i < len(int32Samples); i++ {
residue32Int[i] = *(I.Mod(&int32Samples[i], &int32SamplesLt[i]))
}
for i := 0; i < len(big32Samples); i++ {
residue32Big[i] = *(B.Mod(&big32Samples[i], &big32SamplesLt[i]))
}

for i := 0; i < len(int64Samples); i++ {
residue64Int[i] = *(I.Mod(&int64Samples[i], &int64Samples[i]))
}
for i := 0; i < len(big64Samples); i++ {
residue64Big[i] = *(B.Mod(&big64Samples[i], &big64Samples[i]))
}

for i := 0; i < len(int128Samples); i++ {
residue128Int[i] = *(I.Mod(&int128Samples[i], &int128Samples[i]))
}
for i := 0; i < len(big128Samples); i++ {
residue128Big[i] = *(B.Mod(&big128Samples[i], &big128Samples[i]))
}

for i := 0; i < len(int192Samples); i++ {
residue192Int[i] = *(I.Mod(&int192Samples[i], &int192Samples[i]))
}
for i := 0; i < len(big192Samples); i++ {
residue192Big[i] = *(B.Mod(&big192Samples[i], &big192Samples[i]))
}

for i := 0; i < len(int256Samples); i++ {
residue256Int[i] = *(I.Mod(&int256Samples[i], &int256SamplesLt[i]))
}
for i := 0; i < len(big256Samples); i++ {
residue256Big[i] = *(B.Mod(&big256Samples[i], &big256SamplesLt[i]))
}

b.Run("small/uint256", func(b *testing.B) { benchmarkAddModUint256(b, &residue32Int, &int32SamplesLt) })
b.Run("small/big", func(b *testing.B) { benchmarkAddModBig(b, &residue32Big, &big32SamplesLt) })
b.Run("mod64/uint256", func(b *testing.B) { benchmarkAddModUint256(b, &residue256Int, &int64Samples) })
b.Run("mod64/big", func(b *testing.B) { benchmarkAddModBig(b, &residue256Big, &big64Samples) })
b.Run("mod128/uint256", func(b *testing.B) { benchmarkAddModUint256(b, &residue256Int, &int128Samples) })
b.Run("mod128/big", func(b *testing.B) { benchmarkAddModBig(b, &residue256Big, &big128Samples) })
b.Run("mod192/uint256", func(b *testing.B) { benchmarkAddModUint256(b, &residue256Int, &int192Samples) })
b.Run("mod192/big", func(b *testing.B) { benchmarkAddModBig(b, &residue256Big, &big192Samples) })
b.Run("mod256/uint256", func(b *testing.B) { benchmarkAddModUint256(b, &residue256Int, &int256SamplesLt) })
b.Run("mod256/big", func(b *testing.B) { benchmarkAddModBig(b, &residue256Big, &big256SamplesLt) })
}
}

Expand Down
1 change: 1 addition & 0 deletions fuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright 2020 uint256 Authors
// SPDX-License-Identifier: BSD-3-Clause

//go:build gofuzz
// +build gofuzz

package uint256
Expand Down
Loading

0 comments on commit e051979

Please sign in to comment.