Skip to content

Commit 5087a1c

Browse files
committed
refactor to use [2]uint64
1 parent f4d3254 commit 5087a1c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

core/types/transaction.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,23 @@ const (
5252
SetCodeTxType = 0x04
5353
)
5454

55-
type TxTypeBitVec [(SetCodeTxType + 1 + 7) / 8]byte
55+
type txTypeBitVec [2]uint64
5656

57-
func (v *TxTypeBitVec) Set(txType byte) {
58-
if txType >= byte(len(v)*8) {
57+
func (v *txTypeBitVec) Set(txType byte) {
58+
if txType >= byte(len(v)*64) {
5959
panic("tx type out of range")
6060
}
61-
v[txType/8] |= 1 << (txType % 8)
61+
v[txType/64] |= 1 << (txType % 64)
6262
}
6363

64-
func (v *TxTypeBitVec) Has(txType byte) bool {
65-
if txType >= byte(len(v)*8) {
64+
func (v *txTypeBitVec) Has(txType byte) bool {
65+
if txType >= byte(len(v)*64) {
6666
return false
6767
}
68-
return v[txType/8]&(1<<(txType%8)) != 0
68+
return v[txType/64]&(1<<(txType%64)) != 0
6969
}
7070

71-
func (v *TxTypeBitVec) Equals(o *TxTypeBitVec) bool {
71+
func (v *txTypeBitVec) Equals(o *txTypeBitVec) bool {
7272
return *v == *o
7373
}
7474

core/types/transaction_signing.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ type Signer interface {
182182
// modernSigner is the signer implementation that handles non-legacy transaction types.
183183
// For legacy transactions, it defers to one of the legacy signers (frontier, homestead, eip155).
184184
type modernSigner struct {
185-
txTypeBitVec TxTypeBitVec
185+
txTypeBitVec txTypeBitVec
186186
chainID *big.Int
187187
legacy Signer
188188
}

0 commit comments

Comments
 (0)