Change Byte -> UByte conversion to use a "Word -> UByte" conversion, rather than introducing a new "Byte -> UByte" conversion.

The latter would require more changes to the code generator to understand it, whereas this approach doesn't require any changes. This is arguably less clean, but it matches other places where a byte value is subsequently operated on as a word without an explicit conversion, and the assembly instruction generated is the same.
This commit is contained in:
Stephen Heumann 2015-12-25 18:46:15 -06:00
parent a39c06d268
commit 0df71da4f1
2 changed files with 4 additions and 2 deletions

View File

@ -857,6 +857,9 @@ if codeGeneration then begin
else if (baseTypeEnum(fp1) in [cgUByte])
and (baseTypeEnum(fp2) in [cgByte,cgUByte]) then
goto 1
else if (baseTypeEnum(fp1) = cgByte)
and (baseTypeEnum(fp2) = cgUByte) then
lcode^.q := (ord(cgWord) << 4) | ord(cgUByte)
else
lcode^.q := (fp1 << 4) | fp2;

View File

@ -1131,7 +1131,6 @@ const {note: these constants list all legal }
cExtended = $09;
cVoid = $0B;
byteToUByte = $01;
byteToWord = $02;
byteToUword = $03;
byteToLong = $04;
@ -1250,7 +1249,7 @@ else if op^.q in [ubyteToLong,ubyteToUlong,uwordToLong,uwordToUlong] then
GenImplied(m_pha);
end; {else}
end {else if}
else if op^.q in [byteToUByte,wordToByte,wordToUbyte,uwordToByte,uwordToUbyte] then
else if op^.q in [wordToByte,wordToUbyte,uwordToByte,uwordToUbyte] then
GenNative(m_and_imm, immediate, $00FF, nil, 0)
else if op^.q in [byteToReal,uByteToReal,wordToReal] then
GenCall(11)