value range propagation for _bitwise_ OR

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Apr 10 19:21:07 PDT 2010


On 04/10/2010 08:58 PM, Adam D. Ruppe wrote:
> On Sat, Apr 10, 2010 at 08:42:54PM -0500, Andrei Alexandrescu wrote:
>> What results does it yield with my main() test harness?
>
> total=100000000; equal=14585400 (14.5854%)
>
> I think that's a perfect result. Here's why: the equality comparison checks
> two specific values, (a, b), but the maxOr functions return the max for the
> interval ([0, a], [0, b]). It wouldn't always be equal, since there are other
> values in there that can reach the max.

Yah, it's clear that we're not looking anywhere near 100%. I'm a bit sad 
we don't have an adequate baseline, but the fact that two distinct 
methods obtained the same result is encouraging.

> For example, a = 4, b = 4. 100|100 == 100, but that range also include 4|3,
> 100 | 011 == 111, which is the max.
>
>
> Your maxOR function gives the same percentage, for probably the same reason.
> Though, mine runs ~7x faster on my box.

Then you haven't wasted your day!

On to the next task: compute minOR and maxOR for _signed_ values. It 
turns out minOR its also nontrivial...

When we're done, we can pass the functions to Walter so he can integrate 
them within his compiler. Right now the compiler uses a wrong algorithm.



Andrei



More information about the Digitalmars-d mailing list