addr_range.hh (9235:5aa4896ed55a) | addr_range.hh (9279:8b16c3804bda) |
---|---|
1/* 2 * Copyright (c) 2012 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 55 unchanged lines hidden (view full) --- 64 {} 65 66 AddrRange(const std::pair<Addr, Addr> &r) 67 : start(r.first), end(r.second) 68 {} 69 70 Addr size() const { return end - start + 1; } 71 bool valid() const { return start < end; } | 1/* 2 * Copyright (c) 2012 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 55 unchanged lines hidden (view full) --- 64 {} 65 66 AddrRange(const std::pair<Addr, Addr> &r) 67 : start(r.first), end(r.second) 68 {} 69 70 Addr size() const { return end - start + 1; } 71 bool valid() const { return start < end; } |
72 73 /** 74 * Determine if another range intersects this one, i.e. if there 75 * is an address that is both in this range and the other 76 * range. No check is made to ensure either range is valid. 77 * 78 * @param r Range to intersect with 79 * @return true if the intersection of the two ranges is not empty 80 */ 81 bool intersects(const AddrRange& r) const 82 { 83 return (start <= r.start && end >= r.start) || 84 (start <= r.end && end >= r.end); 85 } 86 87 /** 88 * Determine if this range is a subset of another range, i.e. if 89 * every address in this range is also in the other range. No 90 * check is made to ensure either range is valid. 91 * 92 * @param r Range to compare with 93 * @return true if the this range is a subset of the other one 94 */ 95 bool isSubset(const AddrRange& r) const 96 { 97 return start >= r.start && end <= r.end; 98 } |
|
72}; 73 74/** 75 * Keep the operators away from SWIG. 76 */ 77#ifndef SWIG 78 79/** --- 47 unchanged lines hidden --- | 99}; 100 101/** 102 * Keep the operators away from SWIG. 103 */ 104#ifndef SWIG 105 106/** --- 47 unchanged lines hidden --- |