Skip to content

Commit

Permalink
change package name
Browse files Browse the repository at this point in the history
  • Loading branch information
notJoon committed Sep 26, 2024
1 parent 575ee9d commit ad5d77f
Show file tree
Hide file tree
Showing 21 changed files with 39 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@

# Go workspace file
go.work

int256
2 changes: 1 addition & 1 deletion arithmetic.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This includes basic binary operations such as addition, subtraction, multiplication, division, and modulo operations
// as well as overflow checks, and negation. These functions are essential for numeric
// calculations using 256-bit unsigned integers.
package u256
package uint256

import (
"math/bits"
Expand Down
12 changes: 11 additions & 1 deletion arithmetic_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package u256
package uint256

import "testing"

Expand Down Expand Up @@ -153,6 +153,16 @@ func TestDiv(t *testing.T) {
}
}

func BenchmarkDiv(b *testing.B) {
x := MustFromDecimal("31337")
y := MustFromDecimal("3")
z := &Uint{}
b.ResetTimer()
for i := 0; i < b.N; i++ {
z.Div(x, y)
}
}

func TestMod(t *testing.T) {
tests := []binOp2Test{
{"31337", "3", "2"},
Expand Down
2 changes: 1 addition & 1 deletion bits.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// the code in this package will not be used. Which
// functions are implemented by the compiler depends on the
// architecture and the Go release.
package u256
package uint256

// const uintSize = 32 << (^uint(0) >> 63) // 32 or 64

Expand Down
2 changes: 1 addition & 1 deletion bits_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

//go:build !compiler_bootstrap

package u256
package uint256

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion bits_table.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bitwise.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// bitwise contains bitwise operations for Uint instances.
// This file includes functions to perform bitwise AND, OR, XOR, and NOT operations, as well as bit shifting.
// These operations are crucial for manipulating individual bits within a 256-bit unsigned integer.
package u256
package uint256

// Or sets z = x | y and returns z.
func (z *Uint) Or(x, y *Uint) *Uint {
Expand Down
2 changes: 1 addition & 1 deletion bitwise_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package u256
package uint256

import "testing"

Expand Down
2 changes: 1 addition & 1 deletion cmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// These comparison functions cover a range of operations including equality checks, less than/greater than
// evaluations, and specialized comparisons such as signed greater than. These are fundamental for logical
// decision making based on Uint values.
package u256
package uint256

import (
"math/bits"
Expand Down
2 changes: 1 addition & 1 deletion cmp_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package u256
package uint256

import (
"strings"
Expand Down
2 changes: 1 addition & 1 deletion coversion.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// conversions contains methods for converting Uint instances to other types and vice versa.
// This includes conversions to and from basic types such as uint64 and int32, as well as string representations
// and byte slices. Additionally, it covers marshaling and unmarshaling for JSON and other text formats.
package u256
package uint256

import (
"encoding/binary"
Expand Down
2 changes: 1 addition & 1 deletion coversion_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package u256
package uint256

import "testing"

Expand Down
2 changes: 1 addition & 1 deletion errors.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package u256
package uint256

import (
"errors"
Expand Down
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
module github.com/gnoswap-labs/uint256

go 1.21.6

require (
github.com/holiman/uint256 v1.2.2 // indirect
github.com/linhbkhn95/int256 v0.0.3 // indirect
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
github.com/holiman/uint256 v1.2.2 h1:TXKcSGc2WaxPD2+bmzAsVthL4+pEN0YwXcL5qED83vk=
github.com/holiman/uint256 v1.2.2/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw=
github.com/linhbkhn95/int256 v0.0.3 h1:krzOksQaUEiJh3YTZGFNAmH9U06rp5qXjjEjAYhVRxk=
github.com/linhbkhn95/int256 v0.0.3/go.mod h1:Diyo8xxncRVZJbuMOJENeYOloCZPO1uLALyd23ZPkiY=
2 changes: 1 addition & 1 deletion mod.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package u256
package uint256

import (
"math/bits"
Expand Down
2 changes: 1 addition & 1 deletion runtest.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package u256
package uint256

func Hello() uint64 {
x := NewUint(1)
Expand Down
2 changes: 1 addition & 1 deletion strconv.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package u256
package uint256

const fastSmalls = true // enable fast path for small integers

Expand Down
2 changes: 1 addition & 1 deletion u256.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Ported from https://github.com/holiman/uint256
// This package provides a 256-bit unsigned integer type, Uint256, and associated functions.
package u256
package uint256

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion u256_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package u256
package uint256

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion utils.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package u256
package uint256

// lower(c) is a lower-case letter if and only if
// c is either that lower-case letter or the equivalent upper-case letter.
Expand Down

0 comments on commit ad5d77f

Please sign in to comment.