[Issue 7181] Make bswap a recognized sequence, rather than an intrinsic
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 29 04:21:39 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7181
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bearophile_hugs at eml.cc
--- Comment #1 from bearophile_hugs at eml.cc 2011-12-29 04:21:37 PST ---
(In reply to comment #0)
> In the same way that abs, rol and ror are recognized, bswap(int x)
> could be identified from:
>
> ( x << 24 ) | ( x << 8 ) & 0xff0000 | ( x >> 8 ) & 0xff00 | ( x >> 24 );
>
> and this would be completely portable.
Even if this pattern gets recognized and optimized, I suggest to keep a bswap
function in Phobos, to avoid writing all that bug-prone stuff (I'd like a
rol/ror function pair too in Phobos).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list