git://wimlib.net
/
wimlib
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6cf6635
)
Big endian fix: load_u24_unaligned() must be consistent with loaded_u32_to_u24()
author
Eric Biggers
<ebiggers3@gmail.com>
Mon, 19 Oct 2015 00:39:26 +0000
(19:39 -0500)
committer
Eric Biggers
<ebiggers3@gmail.com>
Mon, 19 Oct 2015 00:48:15 +0000
(19:48 -0500)
include/wimlib/unaligned.h
patch
|
blob
|
history
diff --git
a/include/wimlib/unaligned.h
b/include/wimlib/unaligned.h
index 34240bd0b6e5669b9da266d7b9f9f4099a5bc2a4..3fd35a4df107e7e9140c9603e45fc6445405ebd6 100644
(file)
--- 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
}