From 0df71da4f1372bc013e17b15c5c23375ed86265a Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Fri, 25 Dec 2015 18:46:15 -0600 Subject: [PATCH] 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. --- CGI.pas | 3 +++ Gen.pas | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CGI.pas b/CGI.pas index bf39922..225e231 100644 --- a/CGI.pas +++ b/CGI.pas @@ -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; diff --git a/Gen.pas b/Gen.pas index a925a4c..4578189 100644 --- a/Gen.pas +++ b/Gen.pas @@ -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)