Byte Order Swapping Function

Steven Schveighoffer schveiguy at yahoo.com
Thu Jul 14 04:19:53 PDT 2011


On Thu, 14 Jul 2011 06:12:00 -0400, Piotr Szturmaj <bncrbme at jadamspam.pl>  
wrote:


> 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?

A complier intrinsic is a special function that the compiler replaces with  
inline code.  The idea is, some targets of the compiler have instructions  
which implement the function, so instead of doing a function call and  
inline assembly, the compiler just replaces the call to a single  
instruction (in this case bswap).

So the answer is, you won't find that code anywhere :)  If you grep for  
bswap in the dmd source, you might find out how it does it.

-Steve


More information about the Digitalmars-d mailing list