| 340 | }; |
| 341 | |
| 342 | auto section(const vec<byte_t>& binary, bin::sec_t sec) -> const byte_t* { |
| 343 | const byte_t* end = binary.get() + binary.size(); |
| 344 | const byte_t* pos = binary.get() + 8; // skip header |
| 345 | while (pos < end && *pos++ != sec) { |
| 346 | auto size = bin::u32(pos); |
| 347 | pos += size; |
| 348 | } |
| 349 | if (pos == end) return nullptr; |
| 350 | bin::u32_skip(pos); |
| 351 | return pos; |
| 352 | } |
| 353 | |
| 354 | auto section_end(const vec<byte_t>& binary, bin::sec_t sec) -> const byte_t* { |
| 355 | const byte_t* end = binary.get() + binary.size(); |