/src/hermes/lib/ADT/CompactArray.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) Meta Platforms, Inc. and affiliates. |
3 | | * |
4 | | * This source code is licensed under the MIT license found in the |
5 | | * LICENSE file in the root directory of this source tree. |
6 | | */ |
7 | | |
8 | | #include "hermes/ADT/CompactArray.h" |
9 | | |
10 | | namespace hermes { |
11 | | |
12 | 99 | void CompactArray::scaleUp() { |
13 | 99 | assert(scale_ < UINT32 && "cannot go above 32 bits"); |
14 | 0 | CompactArray newTable(size_, (Scale)(scale_ + 1)); |
15 | 202k | for (uint32_t idx = 0; idx < size_; ++idx) { |
16 | 202k | bool success = newTable.trySet(idx, get(idx)); |
17 | 202k | assert(success && "value no longer fits"); |
18 | 0 | (void)success; |
19 | 202k | } |
20 | 99 | swap(newTable); |
21 | 99 | } |
22 | | |
23 | | } // namespace hermes |