value range propagation for _bitwise_ OR

Steven Schveighoffer schveiguy at yahoo.com
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: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=108869

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:

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=108916

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).

-Steve



More information about the Digitalmars-d mailing list