addr_range_map.hh (9409:e399b6c18b76) | addr_range_map.hh (9411:22e15f9c3fda) |
---|---|
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 --- 60 unchanged lines hidden (view full) --- 69 find(const AddrRange &r) const 70 { 71 if (tree.empty()) 72 return tree.end(); 73 74 const_iterator i = tree.upper_bound(r); 75 76 if (i == tree.begin()) { | 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 --- 60 unchanged lines hidden (view full) --- 69 find(const AddrRange &r) const 70 { 71 if (tree.empty()) 72 return tree.end(); 73 74 const_iterator i = tree.upper_bound(r); 75 76 if (i == tree.begin()) { |
77 if (i->first.intersects(r)) | 77 if (i->first.intersects(r)) { |
78 return i; | 78 return i; |
79 else 80 // Nothing could match, so return end() | 79 } else { |
81 return tree.end(); | 80 return tree.end(); |
81 } |
|
82 } 83 84 --i; 85 86 if (i->first.intersects(r)) 87 return i; 88 | 82 } 83 84 --i; 85 86 if (i->first.intersects(r)) 87 return i; 88 |
89 // if we are looking at an interleaved range, also step 90 // backwards through the ranges while we are looking at ranges 91 // that are part of the same contigous chunk 92 if (i->first.interleaved()) { 93 AddrRange orig_range = i->first; 94 95 while (i != tree.begin() && i->first.mergesWith(orig_range)) { 96 --i; 97 if (i->first.intersects(r)) { 98 return i; 99 } 100 } 101 102 // we could leave the loop based on reaching the first 103 // element, so we must still check for an intersection 104 if (i->first.intersects(r)) 105 return i; 106 } 107 |
|
89 return tree.end(); 90 } 91 92 const_iterator 93 find(const Addr &r) const 94 { 95 return find(RangeSize(r, 1)); 96 } --- 72 unchanged lines hidden --- | 108 return tree.end(); 109 } 110 111 const_iterator 112 find(const Addr &r) const 113 { 114 return find(RangeSize(r, 1)); 115 } --- 72 unchanged lines hidden --- |