diff options
Diffstat (limited to 'gcc/java/javaop.h')
-rw-r--r-- | gcc/java/javaop.h | 9 |
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; } |