Unclear explanation for some builtins

Jonathan Wakely jwakely.gcc@gmail.com
Thu Apr 21 17:29:00 GMT 2016


On 21 April 2016 at 18:10, Eyal Rozenberg wrote:
>
> Hello,
>
> I was just reading this:
>
> https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
>
> and I believe the explanation regarding bswap32 and bswap64 is unclear.
> It refers to the explanation of bswap16, but in that case, swapping both
> halves and reversing the order of bytes constitutes the same action,
> while in 32-bit and 64-bit values that's not the case.

If you only look at the example you could think maybe it swaps both
halves, but "the order of the bytes reversed" seems perfectly clear
that it doesn't.

If 0xaabbccdd became 0xccddaabb then that would not reverse the order
of the bytes, so your interpretation doesn't match the documented
behaviour.



More information about the Gcc-help mailing list