diff options
author | Matt Turner <mattst88@gmail.com> | 2019-11-05 10:22:58 -0800 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2019-11-05 11:24:11 -0800 |
commit | 783bd734e8c8eb06c400a471004e329244ef995f (patch) | |
tree | 1e88f492d1e26fa32669d7702d584cae10e023a4 /hv_macro.h | |
parent | 559a77e6ab7351f4fe0620988948451e7091a1eb (diff) | |
download | perl-783bd734e8c8eb06c400a471004e329244ef995f.tar.gz |
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: https://github.com/Perl/perl5/issues/17244
Fixes: https://github.com/Perl/perl5/issues/17247
Fixes: https://rt.cpan.org/Ticket/Display.html?id=130890
Diffstat (limited to 'hv_macro.h')
-rw-r--r-- | hv_macro.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/hv_macro.h b/hv_macro.h index b96057eab8..d6d9e8a304 100644 --- a/hv_macro.h +++ b/hv_macro.h @@ -22,17 +22,17 @@ #ifndef U8TO16_LE #if (BYTEORDER == 0x1234 || BYTEORDER == 0x12345678) - #define U8TO16_LE(ptr) ((U32)(ptr)[1]|(U32)(ptr)[0]<<8) - #define U8TO32_LE(ptr) ((U32)(ptr)[3]|(U32)(ptr)[2]<<8|(U32)(ptr)[1]<<16|(U32)(ptr)[0]<<24) - #define U8TO64_LE(ptr) ((U64)(ptr)[7]|(U64)(ptr)[6]<<8|(U64)(ptr)[5]<<16|(U64)(ptr)[4]<<24|\ - (U64)(ptr)[3]<<32|(U64)(ptr)[2]<<40|\ - (U64)(ptr)[1]<<48|(U64)(ptr)[0]<<56) - #elif (BYTEORDER == 0x4321 || BYTEORDER == 0x87654321) #define U8TO16_LE(ptr) ((U32)(ptr)[0]|(U32)(ptr)[1]<<8) #define U8TO32_LE(ptr) ((U32)(ptr)[0]|(U32)(ptr)[1]<<8|(U32)(ptr)[2]<<16|(U32)(ptr)[3]<<24) #define U8TO64_LE(ptr) ((U64)(ptr)[0]|(U64)(ptr)[1]<<8|(U64)(ptr)[2]<<16|(U64)(ptr)[3]<<24|\ (U64)(ptr)[4]<<32|(U64)(ptr)[5]<<40|\ (U64)(ptr)[6]<<48|(U64)(ptr)[7]<<56) + #elif (BYTEORDER == 0x4321 || BYTEORDER == 0x87654321) + #define U8TO16_LE(ptr) ((U32)(ptr)[1]|(U32)(ptr)[0]<<8) + #define U8TO32_LE(ptr) ((U32)(ptr)[3]|(U32)(ptr)[2]<<8|(U32)(ptr)[1]<<16|(U32)(ptr)[0]<<24) + #define U8TO64_LE(ptr) ((U64)(ptr)[7]|(U64)(ptr)[6]<<8|(U64)(ptr)[5]<<16|(U64)(ptr)[4]<<24|\ + (U64)(ptr)[3]<<32|(U64)(ptr)[2]<<40|\ + (U64)(ptr)[1]<<48|(U64)(ptr)[0]<<56) #endif #endif |