From 0e80844e333acbfa47e886d512dc4eeaad81b3df Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Tue, 30 Aug 2011 23:34:02 +0000 Subject: [PATCH] * also zero-extend incoming byte/word const-parameters (instead of only value parameters) * fixed upper bound check to determine whether zero-extending is required git-svn-id: branches/jvmbackend@18917 - --- compiler/jvm/hlcgcpu.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/jvm/hlcgcpu.pas b/compiler/jvm/hlcgcpu.pas index fa2250d8c4..cc90924efb 100644 --- a/compiler/jvm/hlcgcpu.pas +++ b/compiler/jvm/hlcgcpu.pas @@ -888,13 +888,13 @@ implementation as a procvar -- exceptions: widechar (Java-specific type) and ordinal types whose upper bound does not set the sign bit } if (tsym(p).typ=paravarsym) and - (tparavarsym(p).varspez=vs_value) and + (tparavarsym(p).varspez in [vs_value,vs_const]) and (tparavarsym(p).vardef.typ=orddef) and not is_pasbool(tparavarsym(p).vardef) and not is_widechar(tparavarsym(p).vardef) and (tparavarsym(p).vardef.size<4) and not is_signed(tparavarsym(p).vardef) and - (torddef(tparavarsym(p).vardef).high>=(1 shl ((tparavarsym(p).vardef.size-1)*8))) then + (torddef(tparavarsym(p).vardef).high>=(1 shl (tparavarsym(p).vardef.size*8-1))) then begin list:=TAsmList(arg); a_op_const_loc(list,OP_AND,tparavarsym(p).vardef,(1 shl (tparavarsym(p).vardef.size*8))-1,tparavarsym(p).initialloc);