aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/javaop.h
diff options
context:
space:
mode:
authorAndrew Haley <aph@cygnus.com>2000-08-29 16:12:59 +0000
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>2000-08-29 09:12:59 -0700
commit9b1ee05b0e2a948a2612dcc6b9835a91ee855f99 (patch)
tree9e8a6be704176c42bc696fce9ce76e1e2f26270b /gcc/java/javaop.h
parentdc478a5dd45f10a1c9d42230a3eb6c6aa1e50a1d (diff)
downloadgcc-9b1ee05b0e2a948a2612dcc6b9835a91ee855f99.zip
gcc-9b1ee05b0e2a948a2612dcc6b9835a91ee855f99.tar.gz
gcc-9b1ee05b0e2a948a2612dcc6b9835a91ee855f99.tar.bz2
javaop.h (WORD_TO_INT): Mask lower 32 bits of a jword before sign extending.
2000-08-22 Andrew Haley <aph@cygnus.com> * javaop.h (WORD_TO_INT): Mask lower 32 bits of a jword before sign extending. Fixes gcj/321. * jcf-parse.c (get_constant): Mask lower 32 bits of a jint before combining to make a jlong. Fixes gcj/321. (This fixes gcj/321: http://sources.redhat.com/ml/java-prs/2000-q3/msg00146.html http://gcc.gnu.org/ml/gcc-patches/2000-08/msg00897.html) From-SVN: r36037
Diffstat (limited to 'gcc/java/javaop.h')
-rw-r--r--gcc/java/javaop.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/java/javaop.h b/gcc/java/javaop.h
index d8418f7..6ce33ff 100644
--- a/gcc/java/javaop.h
+++ b/gcc/java/javaop.h
@@ -109,13 +109,16 @@ WORD_TO_FLOAT(jword w)
return wu.f;
}
-/* Sign extend w. */
+/* Sign extend w. If the host on which this cross-compiler runs uses
+ a 64-bit type for jword the appropriate sign extension is
+ performed; if it's a 32-bit type the arithmetic does nothing but is
+ harmless. */
static inline jint
WORD_TO_INT(jword w)
{
- jint n = w;
+ jint n = w & 0xffffffff; /* Mask lower 32 bits. */
n ^= (jint)1 << 31;
- n -= (jint)1 << 31;
+ n -= (jint)1 << 31; /* Sign extend lower 32 bits to upper. */
return n;
}