Skip to content

Commit 783bd73

Browse files
mattst88khwilliamson
authored andcommitted
Fix the UTO*_LE macros
Embarrassingly I got confused and swapped them (BYTEORDER == 0x1234 etc is not great...). Somehow the perl test suite still passes with this, but fortunately the test suite for modules like Algorithm-MinPerfHashTwoLevel caught the problem. Fixes: #17244 Fixes: #17247 Fixes: https://rt.cpan.org/Ticket/Display.html?id=130890
1 parent 559a77e commit 783bd73

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

hv_macro.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222

2323
#ifndef U8TO16_LE
2424
#if (BYTEORDER == 0x1234 || BYTEORDER == 0x12345678)
25-
#define U8TO16_LE(ptr) ((U32)(ptr)[1]|(U32)(ptr)[0]<<8)
26-
#define U8TO32_LE(ptr) ((U32)(ptr)[3]|(U32)(ptr)[2]<<8|(U32)(ptr)[1]<<16|(U32)(ptr)[0]<<24)
27-
#define U8TO64_LE(ptr) ((U64)(ptr)[7]|(U64)(ptr)[6]<<8|(U64)(ptr)[5]<<16|(U64)(ptr)[4]<<24|\
28-
(U64)(ptr)[3]<<32|(U64)(ptr)[2]<<40|\
29-
(U64)(ptr)[1]<<48|(U64)(ptr)[0]<<56)
30-
#elif (BYTEORDER == 0x4321 || BYTEORDER == 0x87654321)
3125
#define U8TO16_LE(ptr) ((U32)(ptr)[0]|(U32)(ptr)[1]<<8)
3226
#define U8TO32_LE(ptr) ((U32)(ptr)[0]|(U32)(ptr)[1]<<8|(U32)(ptr)[2]<<16|(U32)(ptr)[3]<<24)
3327
#define U8TO64_LE(ptr) ((U64)(ptr)[0]|(U64)(ptr)[1]<<8|(U64)(ptr)[2]<<16|(U64)(ptr)[3]<<24|\
3428
(U64)(ptr)[4]<<32|(U64)(ptr)[5]<<40|\
3529
(U64)(ptr)[6]<<48|(U64)(ptr)[7]<<56)
30+
#elif (BYTEORDER == 0x4321 || BYTEORDER == 0x87654321)
31+
#define U8TO16_LE(ptr) ((U32)(ptr)[1]|(U32)(ptr)[0]<<8)
32+
#define U8TO32_LE(ptr) ((U32)(ptr)[3]|(U32)(ptr)[2]<<8|(U32)(ptr)[1]<<16|(U32)(ptr)[0]<<24)
33+
#define U8TO64_LE(ptr) ((U64)(ptr)[7]|(U64)(ptr)[6]<<8|(U64)(ptr)[5]<<16|(U64)(ptr)[4]<<24|\
34+
(U64)(ptr)[3]<<32|(U64)(ptr)[2]<<40|\
35+
(U64)(ptr)[1]<<48|(U64)(ptr)[0]<<56)
3636
#endif
3737
#endif
3838

0 commit comments

Comments
 (0)