mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 07:30:46 +02:00
* internal compiler handling of Val() fixed for 16/8-bit CPUs
git-svn-id: branches/i8086@24049 -
This commit is contained in:
parent
cac6ac38d0
commit
615d6e4a51
@ -1369,6 +1369,47 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function get_val_int_func(ordtype: tordtype): string;
|
||||||
|
const
|
||||||
|
{$if defined(cpu64bitaddr)}
|
||||||
|
oversized_types = [];
|
||||||
|
{$elseif defined(cpu32bitalu)}
|
||||||
|
oversized_types = [s64bit,u64bit];
|
||||||
|
{$elseif defined(cpu16bitalu)}
|
||||||
|
oversized_types = [s64bit,u64bit,s32bit,u32bit];
|
||||||
|
{$elseif defined(cpu8bitalu)}
|
||||||
|
oversized_types = [s64bit,u64bit,s32bit,u32bit,s16bit,u16bit];
|
||||||
|
{$endif}
|
||||||
|
begin
|
||||||
|
if not (ordtype in [s64bit,u64bit,s32bit,u32bit,s16bit,u16bit,s8bit,u8bit]) then
|
||||||
|
internalerror(2013032603);
|
||||||
|
|
||||||
|
if ordtype in oversized_types then
|
||||||
|
begin
|
||||||
|
case ordtype of
|
||||||
|
s64bit: exit('int64');
|
||||||
|
u64bit: exit('qword');
|
||||||
|
s32bit: exit('longint');
|
||||||
|
u32bit: exit('longword');
|
||||||
|
s16bit: exit('smallint');
|
||||||
|
u16bit: exit('word');
|
||||||
|
else
|
||||||
|
internalerror(2013032604);
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
case ordtype of
|
||||||
|
s64bit,s32bit,s16bit,s8bit: exit('sint');
|
||||||
|
u64bit,u32bit,u16bit,u8bit: exit('uint');
|
||||||
|
else
|
||||||
|
internalerror(2013032604);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
internalerror(2013032605);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tinlinenode.handle_val: tnode;
|
function tinlinenode.handle_val: tnode;
|
||||||
var
|
var
|
||||||
procname,
|
procname,
|
||||||
@ -1490,29 +1531,15 @@ implementation
|
|||||||
orddef:
|
orddef:
|
||||||
begin
|
begin
|
||||||
case torddef(destpara.resultdef).ordtype of
|
case torddef(destpara.resultdef).ordtype of
|
||||||
{$ifdef cpu64bitaddr}
|
s8bit,s16bit,s32bit,s64bit,
|
||||||
s64bit,
|
u8bit,u16bit,u32bit,u64bit:
|
||||||
{$endif cpu64bitaddr}
|
|
||||||
s8bit,
|
|
||||||
s16bit,
|
|
||||||
s32bit:
|
|
||||||
begin
|
begin
|
||||||
suffix := 'sint_';
|
suffix := get_val_int_func(torddef(destpara.resultdef).ordtype) + '_';
|
||||||
{ we also need a destsize para in this case }
|
{ we also need a destsize para in the case of sint }
|
||||||
sizepara := ccallparanode.create(cordconstnode.create
|
if suffix = 'sint_' then
|
||||||
(destpara.resultdef.size,s32inttype,true),nil);
|
sizepara := ccallparanode.create(cordconstnode.create
|
||||||
|
(destpara.resultdef.size,s32inttype,true),nil);
|
||||||
end;
|
end;
|
||||||
{$ifdef cpu64bitaddr}
|
|
||||||
u64bit,
|
|
||||||
{$endif cpu64bitaddr}
|
|
||||||
u8bit,
|
|
||||||
u16bit,
|
|
||||||
u32bit:
|
|
||||||
suffix := 'uint_';
|
|
||||||
{$ifndef cpu64bitaddr}
|
|
||||||
s64bit: suffix := 'int64_';
|
|
||||||
u64bit: suffix := 'qword_';
|
|
||||||
{$endif not cpu64bitaddr}
|
|
||||||
scurrency: suffix := 'currency_';
|
scurrency: suffix := 'currency_';
|
||||||
else
|
else
|
||||||
internalerror(200304225);
|
internalerror(200304225);
|
||||||
|
Loading…
Reference in New Issue
Block a user