Jelajahi Sumber

* always write constant values as signed values, since the JVM does not support
unsigned values (and Jasmin therefore extends them to the next larger size
if they become too big)

git-svn-id: branches/jvmbackend@18686 -

Jonas Maebe 14 tahun lalu
induk
melakukan
b8286c729a
1 mengubah file dengan 7 tambahan dan 2 penghapusan
  1. 7 2
      compiler/agjasmin.pas

+ 7 - 2
compiler/agjasmin.pas

@@ -735,8 +735,13 @@ implementation
         case csym.consttyp of
         case csym.consttyp of
           constord:
           constord:
             { always interpret as signed value, because the JVM does not
             { always interpret as signed value, because the JVM does not
-              support unsigned 64 bit values }
-            result:=tostr(csym.value.valueord.svalue);
+              support unsigned values }
+            case csym.constdef.size of
+              1:result:=tostr(shortint(csym.value.valueord.svalue));
+              2:result:=tostr(smallint(csym.value.valueord.svalue));
+              4:result:=tostr(longint(csym.value.valueord.svalue));
+              8:result:=tostr(csym.value.valueord.svalue);
+            end;
           conststring:
           conststring:
             result:=constastr(pchar(csym.value.valueptr),csym.value.len);
             result:=constastr(pchar(csym.value.valueptr),csym.value.len);
           constreal:
           constreal: