* generic conversaion routines only work on signed types

This commit is contained in:
carl 2003-02-15 22:15:57 +00:00
parent abb6577ccd
commit dd0322c646

View File

@ -1371,7 +1371,7 @@ implementation
function ttypeconvnode.first_int_to_real: tnode; function ttypeconvnode.first_int_to_real: tnode;
var var
fname: string[19]; fname: string[32];
typname : string[12]; typname : string[12];
begin begin
{ Get the type name } { Get the type name }
@ -1385,7 +1385,8 @@ implementation
if is_signed(left.resulttype.def) then if is_signed(left.resulttype.def) then
fname := 'fpc_int64_to_'+typname fname := 'fpc_int64_to_'+typname
else else
fname := 'fpc_qword_to_'+typname; {$warning generic conversion from int to float does not support unsigned integers}
fname := 'fpc_int64_to_'+typname;
result := ccallnode.createintern(fname,ccallparanode.create( result := ccallnode.createintern(fname,ccallparanode.create(
left,nil)); left,nil));
left:=nil; left:=nil;
@ -1395,10 +1396,11 @@ implementation
else else
{ other integers are supposed to be 32 bit } { other integers are supposed to be 32 bit }
begin begin
{$warning generic conversion from int to float does not support unsigned integers}
if is_signed(left.resulttype.def) then if is_signed(left.resulttype.def) then
fname := 'fpc_longint_to_'+typname fname := 'fpc_longint_to_'+typname
else else
fname := 'fpc_longword_to_'+typname; fname := 'fpc_longint_to_'+typname;
result := ccallnode.createintern(fname,ccallparanode.create( result := ccallnode.createintern(fname,ccallparanode.create(
left,nil)); left,nil));
left:=nil; left:=nil;
@ -2025,7 +2027,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.101 2003-01-16 22:13:52 peter Revision 1.102 2003-02-15 22:15:57 carl
* generic conversaion routines only work on signed types
Revision 1.101 2003/01/16 22:13:52 peter
* convert_l3 convertlevel added. This level is used for conversions * convert_l3 convertlevel added. This level is used for conversions
where information can be lost like converting widestring->ansistring where information can be lost like converting widestring->ansistring
or dword->byte or dword->byte