value range propagation for _bitwise_ OR
Ali Çehreli
acehreli at yahoo.com
Sun Apr 11 12:45:24 PDT 2010
� wrote:
> The idea is to build a value that is between minA and maxA and will
> set as many bits as possible when or'ed with maxB:
The assumption that maxB would be the value that produces the maximum
a|b is not correct. A lower valued b may fill more gaps in the bit
representation of what is calculated from min_a and max_a.
Your function failed for me with the following values:
min_a 00000000000000000000000011001000 000000c8 200
max_a 00000000000000000000001100001111 0000030f 783
min_b 00000000000000000000000001000101 00000045 69
max_b 00000000000000000000001001100001 00000261 609
calculated 00000000000000000000001001100101 00000265 613
WRONG! empirical 00000000000000000000001111111111 000003ff 1023
emp_max_a 00000000000000000000000110011110 0000019e 414
emp_max_b 00000000000000000000001001100001 00000261 609
Please see my test code elsewhere in the same thread: :)
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=108851
Ali
More information about the Digitalmars-d
mailing list