]> thyrsus.com Git - intercal.git/commitdiff
Optimiser bugfix: loss of precision in bitshifts
authorAlex Smith <ais523@bham.ac.uk>
Thu, 2 Sep 2010 22:35:24 +0000 (23:35 +0100)
committerAlex Smith <ais523@bham.ac.uk>
Thu, 2 Sep 2010 22:35:24 +0000 (23:35 +0100)
src/idiotism.oil

index 68f76c6e07259e3ce218df55910dcf3b71639a83..ee21e5b8f7ced26493b359bac4f37b4d39c15323 100644 (file)
 [combinellshift]
 ((_1 << #{1}2) << #{1}3)->(_1 << #{x2+x3}0)
 [combinelrshift]
-((_1 << #{1}2) >> #{x>x2}3)->(_1 >> #{x3-x2}0)
-((_1 << #{1}2) >> #{x==x2}3)->(_1)
-((_1 << #{1}2) >> #{x<x2}3)->(_1 << #{x2-x3}0)
+((.{65535LU>>x2 >= c}1 << #{1}2) >> #{x>x2}3)->(.1 >> #{x3-x2}0)
+((.{65535LU>>x2 >= c}1 << #{1}2) >> #{x==x2}3)->(.1)
+((.{65535LU>>x2 >= c}1 << #{1}2) >> #{x<x2}3)->(.1 << #{x2-x3}0)
+((:{4294967295LU>>x2 >= c}1 << #{1}2) >> #{x>x2}3)->(:1 >> #{x3-x2}0)
+((:{4294967295LU>>x2 >= c}1 << #{1}2) >> #{x==x2}3)->(:1)
+((:{4294967295LU>>x2 >= c}1 << #{1}2) >> #{x<x2}3)->(:1 << #{x2-x3}0)
 [combinerlshift]
-((_1 >> #{1}2) << #{x>x2}3)->(_1 << #{x3-x2}0)
-((_1 >> #{1}2) << #{x==x2}3)->(_1)
-((_1 >> #{1}2) << #{x<x2}3)->(_1 >> #{x2-x3}0)
+((_{!(((1LU<<x2)-1)&c)}1 >> #{1}2) << #{x>x2}3)->(_1 << #{x3-x2}0)
+((_{!(((1LU<<x2)-1)&c)}1 >> #{1}2) << #{x==x2}3)->(_1)
+((_{!(((1LU<<x2)-1)&c)}1 >> #{1}2) << #{x<x2}3)->(_1 >> #{x2-x3}0)
 [combinerrshift]
 ((_1 >> #{1}2) >> #{1}3)->(_1 >> #{x2+x3}0)
 [nullshift]