mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 17:47:56 +02:00
* keep signess of orginal variable in shl/shr operation
git-svn-id: trunk@8143 -
This commit is contained in:
parent
9f9a539b70
commit
8bd95f4dd4
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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
19
tests/webtbs/tw9299.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user