* keep signess of orginal variable in shl/shr operation

git-svn-id: trunk@8143 -
This commit is contained in:
peter 2007-07-22 22:56:35 +00:00
parent 9f9a539b70
commit 8bd95f4dd4
3 changed files with 27 additions and 1 deletions

1
.gitattributes vendored
View File

@ -8353,6 +8353,7 @@ tests/webtbs/tw9209.pp svneol=native#text/plain
tests/webtbs/tw9221.pp svneol=native#text/plain
tests/webtbs/tw9261.pp svneol=native#text/x-pascal
tests/webtbs/tw9278.pp svneol=native#text/plain
tests/webtbs/tw9299.pp -text
tests/webtbs/tw9306a.pp -text
tests/webtbs/tw9306b.pp -text
tests/webtbs/tw9309.pp -text

View File

@ -516,7 +516,13 @@ implementation
the same as 'shl 1'. It's ugly but compatible with delphi/tp/gcc }
if (not is_64bit(left.resultdef)) and
(torddef(left.resultdef).ordtype<>u32bit) then
inserttypeconv(left,s32inttype);
begin
{ keep singness of orignal type }
if is_signed(left.resultdef) then
inserttypeconv(left,s32inttype)
else
inserttypeconv(left,u32inttype);
end;
inserttypeconv(right,sinttype);

19
tests/webtbs/tw9299.pp Normal file
View File

@ -0,0 +1,19 @@
{$mode objfpc}
{$R+}
function GetShiftedCard(const c: Cardinal): Cardinal;
begin
Result := c shl 24;
end;
function GetShiftedByte(const c: Byte): Cardinal;
begin
Result := c shl 24;
end;
begin
WriteLn(GetShiftedCard(200));
WriteLn(GetShiftedByte(200));
end.