value range propagation for logical OR

BCS none at anon.com
Sat Apr 10 12:08:44 PDT 2010


Hello BCS,

> Hello Andrei,
> 
>> 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.
>> 
> x_bit_max == "the largest bit in x_max ^ x_min"
> x_oth_max == x_bit_max - 1;

// or make that

c_min = (a_max & ~(a_bit_max | a_oth_max);
c_max = max(a_bit_max | b_oth_max, b_bit_max | a_oth_max) | c_min;

> c_max = max(a_bit_max | b_oth_max, b_bit_max | a_oth_max) | (a_max &
> ~(a_bit_max | a_oth_max));
> 

-- 
... <IXOYE><






More information about the Digitalmars-d mailing list