jcf-write.c (push_long_const): lo, hi: New variables.
authorAndrew Haley <aph@redhat.com>
Mon, 22 Apr 2002 16:55:39 +0000 (16:55 +0000)
committerAndrew Haley <aph@gcc.gnu.org>
Mon, 22 Apr 2002 16:55:39 +0000 (16:55 +0000)
2002-04-19  Andrew Haley  <aph@redhat.com>

        * jcf-write.c (push_long_const): lo, hi: New variables.
        Use rshift_double to extract the high part of a 64-bit long.
        Use WORD_TO_INT to extract the low part.

        * jcf-parse.c (get_constant): CONSTANT_Integer: Use an unsigned
        HOST_WIDE_INT for num.  Use JPOOL_UINT to get it.
        CONSTANT_Double: Use JPOOL_UINT to get both halve of a double.

From-SVN: r52618

gcc/java/ChangeLog
gcc/java/jcf-parse.c
gcc/java/jcf-write.c

index 48884bb56d2846964f1c4e4375d4b0fdd6aa2de6..da51e18635dd99e5d6d07e7d1ce3f7a0351192a6 100644 (file)
@@ -1,3 +1,13 @@
+2002-04-19  Andrew Haley  <aph@redhat.com>
+
+        * jcf-write.c (push_long_const): lo, hi: New variables.
+        Use rshift_double to extract the high part of a 64-bit long.
+        Use WORD_TO_INT to extract the low part.
+
+        * jcf-parse.c (get_constant): CONSTANT_Integer: Use an unsigned
+        HOST_WIDE_INT for num.  Use JPOOL_UINT to get it.
+        CONSTANT_Double: Use JPOOL_UINT to get both halve of a double.
+
 2002-04-18  Neil Booth  <neil@daikokuya.demon.co.uk>
 
        * typeck.c (incomplete_type_error): Remove.
index 53e647cb2c6313114a5e652a439f990752ce9b7b..cbf5ac9834c2856554548c5b23e46860f15176c9 100644 (file)
@@ -292,10 +292,10 @@ get_constant (jcf, index)
       }
     case CONSTANT_Long:
       {
-       jint num = JPOOL_INT (jcf, index);
+       unsigned HOST_WIDE_INT num = JPOOL_UINT (jcf, index);
        HOST_WIDE_INT lo, hi;
        lshift_double (num, 0, 32, 64, &lo, &hi, 0);
-       num = JPOOL_INT (jcf, index+1) & 0xffffffff;
+       num = JPOOL_UINT (jcf, index+1);
        add_double (lo, hi, num, 0, &lo, &hi);
        value = build_int_2 (lo, hi);
        TREE_TYPE (value) = long_type_node;
@@ -316,9 +316,9 @@ get_constant (jcf, index)
        HOST_WIDE_INT num[2];
        REAL_VALUE_TYPE d;
        HOST_WIDE_INT lo, hi;
-       num[0] = JPOOL_INT (jcf, index);
+       num[0] = JPOOL_UINT (jcf, index);
        lshift_double (num[0], 0, 32, 64, &lo, &hi, 0);
-       num[0] = JPOOL_INT (jcf, index+1);
+       num[0] = JPOOL_UINT (jcf, index+1);
        add_double (lo, hi, num[0], 0, &lo, &hi);
 
        /* Since ereal_from_double expects an array of HOST_WIDE_INT
index 215d0c56c1767cc0d72955e677547388daebf74f..2988c4726b890dbc4cf5fd6210705e2c73f63b87 100644 (file)
@@ -853,15 +853,20 @@ push_long_const (lo, hi, state)
      HOST_WIDE_INT lo, hi;
      struct jcf_partial *state;
 {
-  if (hi == 0 && lo >= 0 && lo <= 1)
+  HOST_WIDE_INT highpart, dummy;
+  jint lowpart = WORD_TO_INT (lo);
+
+  rshift_double (lo, hi, 32, 64, &highpart, &dummy, 1);
+
+  if (highpart == 0 && (lowpart == 0 || lowpart == 1))
     {
       RESERVE(1);
-      OP1(OPCODE_lconst_0 + lo);
+      OP1(OPCODE_lconst_0 + lowpart);
     }
-  else if ((hi == 0 && (jword)(lo  & 0xFFFFFFFF) < 32768) 
-          || (hi == -1 && (lo & 0xFFFFFFFF) >= (jword)-32768))
+  else if ((highpart == 0 && lowpart > 0 && lowpart < 32768) 
+          || (highpart == -1 && lowpart < 0 && lowpart >= -32768))
       {
-        push_int_const (lo, state);
+        push_int_const (lowpart, state);
         RESERVE (1);
         OP1 (OPCODE_i2l);
       }