[Issue 5703] New: std.intrinsic. and core.bitop.bsf, bsr and bswap should be CTFE-able

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 5 06:23:16 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5703

           Summary: std.intrinsic. and core.bitop.bsf, bsr and bswap
                    should be CTFE-able
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2011-03-05 06:20:20 PST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list