import core.bitop; enum x = bsf(0b111100); enum y = bsr(0b111100); enum z = bswap(0b111100); static assert(x == 2); static assert(y == 5); static assert(z == 0x3C000000); The three functions bsr, bsf and bswap are pure nothrow, but cannot be used in CTFE because there is no source code. These functions should be rewritten in D like bitswap and popcnt.
(In reply to comment #0) > These functions should be rewritten in D like bitswap and popcnt. I think they aren't functions.
(In reply to comment #1) > (In reply to comment #0) > > > These functions should be rewritten in D like bitswap and popcnt. > > I think they aren't functions. They appear to be functions, and can easily implemented as functions too. If they are special-cased in the compiler, I see no reason they can't be recognized in CTFE as well.
https://github.com/D-Programming-Language/dmd/commit/f8b88759dd1a27ec983eb9e439da2a45efce239c