core.bitop.bt semantics

David Nadlinger code at klickverbot.at
Sun Oct 20 12:23:06 PDT 2013


The documentation [1] for core.bitop.bt just says "Tests the bit."

With the function returning an int, the question is whether the 
return value is guaranteed to be 0 or 1, as ensured by the 
current implementation, or whether it can be any non-zero integer 
if the bit is set (as documented for the related bts function).

The std.bitmanip.BitArray formatting functions in 2.064 assume 
the former, and are thus currently broken with LDC. LDC will 
probably end up switching to simply using the D implementation 
anyway as LLVM recognizes the pattern just fine, but I'd like to 
know what to fix first.

David


[1] http://dlang.org/phobos/core_bitop.html


More information about the Digitalmars-d mailing list