[D-runtime] core.bitop.bsr

Martin Nowak dawg at dawgfoto.de
Tue Jul 10 01:10:36 PDT 2012


On Mon, 09 Jul 2012 05:57:26 +0200, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

> Is there any reason that Phobos can't assume that core.bitop.bsr is  
> defined?
> It's not versioned at all, so as far as I can tell, it will always  
> exist. But
> for some reason std.utf.strideImpl currently checks for whether  
> core.bitop.bsr
> is defined. I'd prefer to remove dead code like that. Does anyone know  
> why it
> _wouldn't_ be dead code (i.e. why core.bitop.bsr wouldn't be defined)?
>
> - Jonathan M Davis
> _______________________________________________
> D-runtime mailing list
> D-runtime at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/d-runtime

Yeah we should, bsr is very x86 specific, but intrinsics are broadly  
available
and a handwritten replacement could easily be added.

Just for the reference:

LLVM:  llvm.ctlz.* @ http://llvm.org/docs/LangRef.html#int_ctlz
GCC: __builtin_clz @  
http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Other-Builtins.html


More information about the D-runtime mailing list