github.com/MetalBlockchain/subnet-evm@v0.4.9/precompile/reserved_range.go (about) 1 // (c) 2019-2020, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package precompile 5 6 import ( 7 "bytes" 8 9 "github.com/ethereum/go-ethereum/common" 10 ) 11 12 // AddressRange represents a continuous range of addresses 13 type AddressRange struct { 14 Start common.Address 15 End common.Address 16 } 17 18 // Contains returns true iff [addr] is contained within the (inclusive) 19 func (a *AddressRange) Contains(addr common.Address) bool { 20 addrBytes := addr.Bytes() 21 return bytes.Compare(addrBytes, a.Start[:]) >= 0 && bytes.Compare(addrBytes, a.End[:]) <= 0 22 }