mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
24 lines
610 B
Go
24 lines
610 B
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package utils
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
"github.com/luxfi/geth/common"
|
|
)
|
|
|
|
// AddressRange represents a continuous range of addresses
|
|
type AddressRange struct {
|
|
Start common.Address
|
|
End common.Address
|
|
}
|
|
|
|
// Contains returns true iff [addr] is contained within the (inclusive)
|
|
// range of addresses defined by [a].
|
|
func (a *AddressRange) Contains(addr common.Address) bool {
|
|
addrBytes := addr.Bytes()
|
|
return bytes.Compare(addrBytes, a.Start[:]) >= 0 && bytes.Compare(addrBytes, a.End[:]) <= 0
|
|
}
|