| Conditions | 4 |
| Paths | 6 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 43 | public function getMemoryAddressFromOffset(int $offset): int |
||
| 44 | { |
||
| 45 | $ranges = []; |
||
| 46 | foreach ($this->memory_areas as $memory_area) { |
||
| 47 | $ranges[hexdec($memory_area->file_offset)] = hexdec($memory_area->begin); |
||
| 48 | } |
||
| 49 | ksort($ranges); |
||
| 50 | $file_offset_decided = 0; |
||
| 51 | foreach ($ranges as $file_offset => $memory_begin) { |
||
| 52 | if ($file_offset <= $offset) { |
||
| 53 | $file_offset_decided = $file_offset; |
||
| 54 | } |
||
| 55 | } |
||
| 56 | return $ranges[$file_offset_decided] + ($offset - $file_offset_decided); |
||
| 57 | } |
||
| 59 |