Use std::upper_bound to simplify code a bit.
With std::upper_bound we don't have to check p->input_offset > input_offset.
This commit is contained in:
parent
b05e3b0dd2
commit
45a4fb1a70
|
@ -1,3 +1,7 @@
|
|||
2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
|
||||
|
||||
* merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
|
||||
|
||||
2015-02-09 Mark Wielaard <mjw@redhat.com>
|
||||
|
||||
* gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
|
||||
|
|
|
@ -162,15 +162,12 @@ Object_merge_map::get_output_offset(const Merge_map* merge_map,
|
|||
Input_merge_entry entry;
|
||||
entry.input_offset = input_offset;
|
||||
std::vector<Input_merge_entry>::const_iterator p =
|
||||
std::lower_bound(map->entries.begin(), map->entries.end(),
|
||||
std::upper_bound(map->entries.begin(), map->entries.end(),
|
||||
entry, Input_merge_compare());
|
||||
if (p == map->entries.end() || p->input_offset > input_offset)
|
||||
{
|
||||
if (p == map->entries.begin())
|
||||
return false;
|
||||
--p;
|
||||
gold_assert(p->input_offset <= input_offset);
|
||||
}
|
||||
|
||||
if (input_offset - p->input_offset
|
||||
>= static_cast<section_offset_type>(p->length))
|
||||
|
|
Loading…
Reference in New Issue