value range propagation for logical OR
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sat Apr 10 10:24:58 PDT 2010
On 04/10/2010 12:22 PM, Justin Spahr-Summers wrote:
> On Sat, 10 Apr 2010 12:01:45 -0500, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>>
>> Consider:
>>
>> byte c = a | b;
>>
>> Say you already know min_a, max_a, min_b, and max_b. How do you compute
>> min_c and max_c? I thought of it for a bit and it seems quite tricky.
>>
>>
>> Thanks,
>>
>> Andrei
>
> It seems like it would use the lowest minimum and the highest maximum of
> the two... that's what I personally would find most natural, given the
> semantics of bitwise OR, but maybe I'm just way off base.
I thought the same, but consider:
a = 4;
b = 3;
Then the maximum value is 7, larger than both.
Andrei
More information about the Digitalmars-d
mailing list