| 67 | } |
| 68 | |
| 69 | void Allocation::findRun(uint64_t offset, int32_t* index, int32_t* offsetInRun) |
| 70 | const { |
| 71 | uint64_t skipped = 0; |
| 72 | for (int32_t i = 0; i < runs_.size(); ++i) { |
| 73 | uint64_t size = AllocationTraits::pageBytes(runs_[i].numPages()); |
| 74 | if (offset - skipped < size) { |
| 75 | *index = i; |
| 76 | *offsetInRun = static_cast<int32_t>(offset - skipped); |
| 77 | return; |
| 78 | } |
| 79 | skipped += size; |
| 80 | } |
| 81 | BOLT_UNREACHABLE( |
| 82 | "Seeking to an out of range offset {} in Allocation with {} pages and {} runs", |
| 83 | offset, |
| 84 | numPages_, |
| 85 | runs_.size()); |
| 86 | } |
| 87 | |
| 88 | std::string Allocation::toString() const { |
| 89 | return fmt::format( |