Byte Order Swapping Function

Piotr Szturmaj bncrbme at jadamspam.pl
Thu Jul 14 03:12:00 PDT 2011


Jonathan M Davis wrote:
> I did have to create a 64-bit version for std.datetime, so it has a private
> function called endianSwap64 to do the job. So, it's not like I'm saying that
> the situation couldn't be improved, but druntime and Phobos do currently give
> you the exact same thing that C and C++ do.
>
> - Jonathan M Davis

Yesterday, I had to write my own bswap for ulong because intrinsic 
version supports only uints. Is there any implementation obstacle 
preventing ulong and ushort bswap in core.bitop?

Btw. How compiler intrinsics work? I see there's only bswap declaration 
(without body) in core.bitop. Where can I find compiler code which 
actually substitutes bswap() into real instructions?


More information about the Digitalmars-d mailing list