* tshlshrnode.simplify: in the case of 16-bit or 8-bit shl/shr, AND the right

side constant with 31 (instead of 15 or 7), because that's how the 16-bit and
  8-bit x86 shl/shr instructions behave (even on 16-bit CPUs like 286). The
  change does not affect 32-bit and 64-bit platforms, because there the shift
  is always done in at least 32 bits.

git-svn-id: trunk@27638 -
This commit is contained in:
nickysn 2014-04-23 00:23:27 +00:00
parent 0d3bccaa1b
commit a17797f3ca

View File

@ -592,11 +592,7 @@ implementation
begin
{ shl/shr are unsigned operations, so cut off upper bits }
case resultdef.size of
1:
rvalue:=tordconstnode(right).value and byte($7);
2:
rvalue:=tordconstnode(right).value and byte($f);
4:
1,2,4:
rvalue:=tordconstnode(right).value and byte($1f);
8:
rvalue:=tordconstnode(right).value and byte($3f);