common/math: rename variable name int to n (#29890)

* chore: rename variable name `int` to `in`

* chore: rename variable name `int` to `n`
This commit is contained in:
tianyeyouyou 2024-05-31 15:25:49 +08:00 committed by GitHub
parent 5d7d48fc3e
commit bdc62f9beb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

@ -180,9 +180,9 @@ func BenchmarkByteAtOld(b *testing.B) {
func TestReadBits(t *testing.T) { func TestReadBits(t *testing.T) {
check := func(input string) { check := func(input string) {
want, _ := hex.DecodeString(input) want, _ := hex.DecodeString(input)
int, _ := new(big.Int).SetString(input, 16) n, _ := new(big.Int).SetString(input, 16)
buf := make([]byte, len(want)) buf := make([]byte, len(want))
ReadBits(int, buf) ReadBits(n, buf)
if !bytes.Equal(buf, want) { if !bytes.Equal(buf, want) {
t.Errorf("have: %x\nwant: %x", buf, want) t.Errorf("have: %x\nwant: %x", buf, want)
} }

@ -54,11 +54,11 @@ func (i *HexOrDecimal64) UnmarshalJSON(input []byte) error {
// UnmarshalText implements encoding.TextUnmarshaler. // UnmarshalText implements encoding.TextUnmarshaler.
func (i *HexOrDecimal64) UnmarshalText(input []byte) error { func (i *HexOrDecimal64) UnmarshalText(input []byte) error {
int, ok := ParseUint64(string(input)) n, ok := ParseUint64(string(input))
if !ok { if !ok {
return fmt.Errorf("invalid hex or decimal integer %q", input) return fmt.Errorf("invalid hex or decimal integer %q", input)
} }
*i = HexOrDecimal64(int) *i = HexOrDecimal64(n)
return nil return nil
} }