Work around conservative optimization

David Nadlinger code at
Sun Jun 3 16:51:13 UTC 2018

On 3 Jun 2018, at 12:54, kinke via digitalmars-d-ldc wrote:
> [For endian-ness conversion of integers, we have 
> ldc.intrinsics.llvm_bswap().]

At the risk of pointing out the obvious, I usually find it vastly 
preferable to just write the code in a way that's independent of the 
target platform's endianness – like in Johan's example – and let the 
optimizer deal with eliding the explicit handling if possible. Even 
DMD's optimizer can recognize those patterns just fine.

  — David

More information about the digitalmars-d-ldc mailing list