FR: optimize bit testing for numbers, just like for sets
Original Reporter info from Mantis: runewalsh
-
Reporter name:
Original Reporter info from Mantis: runewalsh
- Reporter name:
Description:
"ssi in ss" gives
004015F5 0fa3c3 bt %eax,%ebx
"bm and (1 shl bit)" gives
00401652 b801000000 mov $0x1,%eax
00401657 d3e0 shl %cl,%eax
00401659 21d8 and %ebx,%eax
Could it get compiled into BT too UwU
Steps to reproduce:
type
SmallSetItem = (ItemA, ItemB, ItemC);
SmallSet = set of SmallSetItem;
var
ssi: SmallSetItem;
ss: SmallSet;
bit, bm: uint32;
begin
ss := [ItemA, ItemB];
if random(1) = 0 then ss += [ItemC];
ssi := SmallSetItem(random(ord(High(SmallSetItem)) + 1));
if ssi in ss then writeln('ssi in ss');
bm := %000;
if random(1) = 0 then bm := %111;
bit := random(3);
if bm and (1 shl bit) <> 0 then writeln('bit in bm');
end.
Mantis conversion info:
- Mantis ID: 38548
- Build: r48765 [2021/02/22]