mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 10:19:28 +02:00

it doesn't have to duplicate any type checking code, and so constant expressions get the same resultdefs as non-constant expressions * properly fixed resultdef determination of "set + setelementn" (follows same rules now as "set + set") * also convert "longint or/xor cardinal" to int64 (needed for correct results with negative numbers and Delphi-compatible) + test * extended 64-to-32 type conversion simplification to also handle or/xor nodes (so if the result is typecasted back to 32 bit, the evaluation can still be done entirely in 32 bit). These changes also enable that optimization in some extra cases (not just anymore for expressions containing only uint32) git-svn-id: trunk@10418 -
34 lines
414 B
ObjectPascal
34 lines
414 B
ObjectPascal
var
|
|
b: byte;
|
|
s: shortint;
|
|
l: longint;
|
|
c: cardinal;
|
|
i: int64;
|
|
begin
|
|
b:=10;
|
|
s:=-128;
|
|
l:=b or s;
|
|
writeln(l);
|
|
if (l<>-118) then
|
|
halt(1);
|
|
l:=b xor s;
|
|
writeln(l);
|
|
if (l<>-118) then
|
|
halt(2);
|
|
b:=129;
|
|
s:=-127;
|
|
l:=b and s;
|
|
writeln(l);
|
|
if (l<>129) then
|
|
halt(3);
|
|
l:=s and b;
|
|
writeln(l);
|
|
if (l<>129) then
|
|
halt(4);
|
|
|
|
l:=-127;
|
|
c:=129;
|
|
i:=l and c;
|
|
writeln(i);
|
|
end.
|