summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2022-03-13 10:27:22 +0100
committerYves Orton <demerphq@gmail.com>2022-04-10 12:03:31 +0800
commitda0367701cbc71b0f74bcf21c3fbead8a333b81b (patch)
treee5b227c430228fc5ac1821927f61ed73b2b89a28
parentbb5e773d6fb68865d8e2c5a392215c27c7b49636 (diff)
downloadperl-da0367701cbc71b0f74bcf21c3fbead8a333b81b.tar.gz
hv_macro.h: only use direct memory loads on little endian machines
Using the shift logic should work correctly anywhere, using direct memory loads will only work correctly on little endian machines.
-rw-r--r--hv_macro.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/hv_macro.h b/hv_macro.h
index a494ad1f55..3f75cdb860 100644
--- a/hv_macro.h
+++ b/hv_macro.h
@@ -31,7 +31,7 @@
#ifndef U8TO16_LE
#define _shifted_octet(type,ptr,idx,shift) (((type)(((U8*)(ptr))[(idx)]))<<(shift))
- #ifdef USE_UNALIGNED_PTR_DEREF
+ #if defined(USE_UNALIGNED_PTR_DEREF) && (BYTEORDER == 0x1234 || BYTEORDER == 0x12345678)
#define U8TO16_LE(ptr) (*((const U16*)(ptr)))
#define U8TO32_LE(ptr) (*((const U32*)(ptr)))
#define U8TO64_LE(ptr) (*((const U64*)(ptr)))