From: Eric Biggers Date: Mon, 19 Oct 2015 00:39:26 +0000 (-0500) Subject: Big endian fix: load_u24_unaligned() must be consistent with loaded_u32_to_u24() X-Git-Tag: v1.8.3~53 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=2509b3acee5941f4271d678d638b8e647df27dae Big endian fix: load_u24_unaligned() must be consistent with loaded_u32_to_u24() --- diff --git a/include/wimlib/unaligned.h b/include/wimlib/unaligned.h index 34240bd0..3fd35a4d 100644 --- a/include/wimlib/unaligned.h +++ b/include/wimlib/unaligned.h @@ -138,7 +138,11 @@ load_u24_unaligned(const u8 *p) return loaded_u32_to_u24(load_u32_unaligned(p)); #else # define LOAD_U24_REQUIRED_NBYTES 3 +# if CPU_IS_BIG_ENDIAN + return ((u32)p[2] << 0) | ((u32)p[1] << 8) | ((u32)p[0] << 16); +# else return ((u32)p[0] << 0) | ((u32)p[1] << 8) | ((u32)p[2] << 16); +# endif #endif }