diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-02-02 00:38:13 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-02-02 00:38:13 +0100 |
commit | 21cd3b718a2311671ef283759b6d3723fa9db232 (patch) | |
tree | 379794e8f2cde7b4ceb39f22a0b6d9b97ca66f72 /isofs | |
parent | 0cc80b3913489e74f6d5a0ac9b8a4c5523d9cecd (diff) | |
download | hurd-21cd3b718a2311671ef283759b6d3723fa9db232.tar.gz hurd-21cd3b718a2311671ef283759b6d3723fa9db232.tar.bz2 hurd-21cd3b718a2311671ef283759b6d3723fa9db232.zip |
Avoid unaligned memory accesses
Diffstat (limited to 'isofs')
-rw-r--r-- | isofs/iso9660.h | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/isofs/iso9660.h b/isofs/iso9660.h index 2fd8cc2b..be96b8f5 100644 --- a/isofs/iso9660.h +++ b/isofs/iso9660.h @@ -102,24 +102,12 @@ struct dirrect static inline unsigned int isonum_733 (unsigned char *addr) { -#if BYTE_ORDER == LITTLE_ENDIAN - return *(unsigned int *)addr; -#elif BYTE_ORDER == BIG_ENDIAN - return *(unsigned int *)(addr + 4); -#else - return - addr[0] | (addr[1] << 8) | (addr[2] << 16) | (addr[3] << 24); -#endif + return addr[0] | (addr[1] << 8) | (addr[2] << 16) | + (((unsigned int) addr[3]) << 24); } static inline unsigned int isonum_723 (unsigned char *addr) { -#if BYTE_ORDER == LITTLE_ENDIAN - return *(unsigned short *)addr; -#elif BYTE_ORDER == BIG_ENDIAN - return *(unsigned short *)addr + 2; -#else return addr[0] | (addr[1] << 8); -#endif } |