| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "courgette/label_manager.h" | 5 #include "courgette/label_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 size_t num_distinct_rva = 0; | 171 size_t num_distinct_rva = 0; |
| 172 for (CRV it(rvas.begin(), rvas.end()); it.has_more(); it.advance()) | 172 for (CRV it(rvas.begin(), rvas.end()); it.has_more(); it.advance()) |
| 173 ++num_distinct_rva; | 173 ++num_distinct_rva; |
| 174 | 174 |
| 175 // Reserve space for |labels_|, populate with sorted RVA and repeats. | 175 // Reserve space for |labels_|, populate with sorted RVA and repeats. |
| 176 DCHECK(labels_.empty()); | 176 DCHECK(labels_.empty()); |
| 177 labels_.reserve(num_distinct_rva); | 177 labels_.reserve(num_distinct_rva); |
| 178 for (CRV it(rvas.begin(), rvas.end()); it.has_more(); it.advance()) { | 178 for (CRV it(rvas.begin(), rvas.end()); it.has_more(); it.advance()) { |
| 179 labels_.push_back(Label(*it.cur())); | 179 labels_.push_back(Label(*it.cur())); |
| 180 base::CheckedNumeric<uint32_t> count = it.repeat(); | 180 labels_.back().count_ = |
| 181 labels_.back().count_ = count.ValueOrDie(); | 181 base::checked_cast<decltype(labels_.back().count_)>(it.repeat()); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace courgette | 185 } // namespace courgette |
| OLD | NEW |