* Read header/entry members in little-endian format. * Returns the offset up to which the read was performed. */
| 379 | * Returns the offset up to which the read was performed. |
| 380 | */ |
| 381 | static size_t read_member(void *src, size_t offset, size_t size_bytes, |
| 382 | void *dst) |
| 383 | { |
| 384 | switch (size_bytes) { |
| 385 | case 1: |
| 386 | *(uint8_t *)dst = read_at_le8(src, offset); |
| 387 | break; |
| 388 | case 2: |
| 389 | *(uint16_t *)dst = read_at_le16(src, offset); |
| 390 | break; |
| 391 | case 4: |
| 392 | *(uint32_t *)dst = read_at_le32(src, offset); |
| 393 | break; |
| 394 | case 8: |
| 395 | *(uint64_t *)dst = read_at_le64(src, offset); |
| 396 | break; |
| 397 | default: |
| 398 | ERROR("Read size not supported %zd\n", size_bytes); |
| 399 | exit(-1); |
| 400 | } |
| 401 | |
| 402 | return (offset + size_bytes); |
| 403 | } |
| 404 | |
| 405 | /* |
| 406 | * Convert to little endian format. |
no test coverage detected