value range propagation for _bitwise_ OR

Steven Schveighoffer schveiguy at
Fri Apr 16 21:43:41 PDT 2010

Andrei Alexandrescu Wrote:

> Looks great, thanks Jerome!
> Now, how about that case in which some or all of the ranges involved 
> include negative values?

I solved already signed values in terms of any valid unsigned solution, see here:

The maxor with all the unsigned casts is the call to the unsigned maxor.  Ditto for minor.

Also, see my one liner for unsigned maxor:

All that is left is to find a quick (possibly one liner?) minor for unsigned.  Maybe there's a quicker signed solution, but the complexity is already O(1) * complexity of unsigned.

Also, someone pointed out that Jerome's highbit is equivalent to the x86 bsr instruction (std.instrinsic.bsr).


More information about the Digitalmars-d mailing list