mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 11:09:33 +01:00
* use ptrsinttype instead of sinttype as code parameter for val: for "normal" 32/64 bit targets this does not matter,
for 8 bit targets like avr this makes code in theory useful for ansistrings etc. git-svn-id: trunk@22161 -
This commit is contained in:
parent
1cd6f2355b
commit
396a9cafa8
@ -1360,9 +1360,9 @@ implementation
|
||||
{ code is not a 32bit parameter (we already checked whether the }
|
||||
{ the code para, if specified, was an orddef) }
|
||||
if not assigned(codepara) or
|
||||
(codepara.resultdef.size<>sinttype.size) then
|
||||
(codepara.resultdef.size<>ptrsinttype.size) then
|
||||
begin
|
||||
tempcode := ctempcreatenode.create(sinttype,sinttype.size,tt_persistent,false);
|
||||
tempcode := ctempcreatenode.create(ptrsinttype,ptrsinttype.size,tt_persistent,false);
|
||||
addstatement(newstatement,tempcode);
|
||||
{ set the resultdef of the temp (needed to be able to get }
|
||||
{ the resultdef of the tempref used in the new code para) }
|
||||
@ -1379,13 +1379,13 @@ implementation
|
||||
{ we need its resultdef later on }
|
||||
codepara.get_paratype;
|
||||
end
|
||||
else if (torddef(codepara.resultdef).ordtype = torddef(sinttype).ordtype) then
|
||||
else if (torddef(codepara.resultdef).ordtype = torddef(ptrsinttype).ordtype) then
|
||||
{ because code is a var parameter, it must match types exactly }
|
||||
{ however, since it will return values in [0..255], both longints }
|
||||
{ and cardinals are fine. Since the formal code para type is }
|
||||
{ longint, insert a typecoversion to longint for cardinal para's }
|
||||
begin
|
||||
codepara.left := ctypeconvnode.create_internal(codepara.left,sinttype);
|
||||
codepara.left := ctypeconvnode.create_internal(codepara.left,ptrsinttype);
|
||||
{ make it explicit, oterwise you may get a nonsense range }
|
||||
{ check error if the cardinal already contained a value }
|
||||
{ > $7fffffff }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user