This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Clean up U8TO*_LE macro implementations
authorMatt Turner <mattst88@gmail.com>
Thu, 5 Sep 2019 04:48:56 +0000 (21:48 -0700)
committerTony Cook <tony@develop-help.com>
Mon, 7 Oct 2019 22:27:43 +0000 (09:27 +1100)
commite8864dba80952684bf3afe83438d4eee0c3939a9
treeef39f361559ca7cabef294085a643c3742e6d4f5
parentee9ac1cd8eb988fea70841eae211b11355711416
Clean up U8TO*_LE macro implementations

The code guarded by #ifndef U32_ALIGNMENT_REQUIRED attempts to optimize
byte-swapping by doing unaligned loads, but accessing data through
unaligned pointers is undefined behavior in C. Moreover, compilers are
more than capable of recognizing these open-coded byte-swap patterns and
emitting a bswap instruction, or an unaligned load instruction, or a
combined load, etc. There's no need for multiple paths to attain the
desired result.

See https://rt.perl.org/Ticket/Display.html?id=133495
hv_macro.h
stadtx_hash.h
zaphod32_hash.h