mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-21 21:32:00 +00:00
Do an explicit conversion when converting from signed to unsigned byte values. This is needed because the value is held in a 16-bit register, sign-extended. The high 8 bits need to be cleared to convert to an unsigned byte.
This fixes the compca06.c test case. Note that this generates inefficient code in the case of loading a signed byte value and then immediately casting it to unsigned (it first sign-extends the value, then masks off the high bits). This should be optimized, but at least the generated code is correct now.
This commit is contained in:
parent
6bd0bef8c5
commit
c28e48a54f
2
CGI.pas
2
CGI.pas
@ -854,7 +854,7 @@ if codeGeneration then begin
|
||||
else if (baseTypeEnum(fp1) in [cgUByte,cgWord,cgUWord])
|
||||
and (baseTypeEnum(fp2) in [cgWord,cgUWord]) then
|
||||
goto 1
|
||||
else if (baseTypeEnum(fp1) in [cgByte,cgUByte])
|
||||
else if (baseTypeEnum(fp1) in [cgUByte])
|
||||
and (baseTypeEnum(fp2) in [cgByte,cgUByte]) then
|
||||
goto 1
|
||||
else
|
||||
|
3
Gen.pas
3
Gen.pas
@ -1131,6 +1131,7 @@ const {note: these constants list all legal }
|
||||
cExtended = $09;
|
||||
cVoid = $0B;
|
||||
|
||||
byteToUByte = $01;
|
||||
byteToWord = $02;
|
||||
byteToUword = $03;
|
||||
byteToLong = $04;
|
||||
@ -1249,7 +1250,7 @@ else if op^.q in [ubyteToLong,ubyteToUlong,uwordToLong,uwordToUlong] then
|
||||
GenImplied(m_pha);
|
||||
end; {else}
|
||||
end {else if}
|
||||
else if op^.q in [wordToByte,wordToUbyte,uwordToByte,uwordToUbyte] then
|
||||
else if op^.q in [byteToUByte,wordToByte,wordToUbyte,uwordToByte,uwordToUbyte] then
|
||||
GenNative(m_and_imm, immediate, $00FF, nil, 0)
|
||||
else if op^.q in [byteToReal,uByteToReal,wordToReal] then
|
||||
GenCall(11)
|
||||
|
Loading…
x
Reference in New Issue
Block a user