From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28151 invoked by alias); 24 Jan 2008 00:27:11 -0000 Received: (qmail 28133 invoked by uid 22791); 24 Jan 2008 00:27:09 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 24 Jan 2008 00:26:40 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m0O0QTDO009703; Wed, 23 Jan 2008 19:26:29 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m0O0QStO017301; Wed, 23 Jan 2008 19:26:28 -0500 Received: from opsy.redhat.com (ton.yyz.redhat.com [10.15.16.15]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m0O0QSHr021114; Wed, 23 Jan 2008 19:26:28 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 25828378324; Wed, 23 Jan 2008 16:49:33 -0700 (MST) To: "Pierre Muller" Cc: "'Eli Zaretskii'" , Subject: Re: [RFA] Handle BINOP_INTDIV in valarith.c References: <002d01c85849$ef420f80$cdc62e80$@u-strasbg.fr> <002401c85c1a$b1997b30$14cc7190$@u-strasbg.fr> <001c01c85e13$a123d9d0$e36b8d70$@u-strasbg.fr> From: Tom Tromey Reply-To: Tom Tromey X-Attribution: Tom Date: Thu, 24 Jan 2008 00:27:00 -0000 In-Reply-To: <001c01c85e13$a123d9d0$e36b8d70$@u-strasbg.fr> (Pierre Muller's message of "Wed\, 23 Jan 2008 23\:59\:37 +0100") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.990 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-01/txt/msg00572.txt.bz2 >>>>> "Pierre" == Pierre Muller writes: >> So IOW, yes :) Pierre> But this means that like C and unlike pascal Pierre> '35 / 2' returns a integer of value 17, while for pascal Pierre> it does return a real of value 17.5. I must have misunderstood your question. I thought you were asking if Java has integer division, which it does. Anyway, it doesn't matter, since I think we understand each other. >> There are also special rules about certain integer divisions. >> Division by zero throws an exception, and MIN_INT/-1 is defined to be >> MIN_INT. Pierre> You probably ment MAX_INT here, no? Nope. Maybe the code is clearer; on some platforms we have to implement integer divide via this function: jint _Jv_divI (jint dividend, jint divisor) { if (__builtin_expect (divisor == 0, false)) { java::lang::ArithmeticException *arithexception = new java::lang::ArithmeticException (JvNewStringLatin1 ("/ by zero")); throw arithexception; } if (dividend == (jint) 0x80000000L && divisor == -1) return dividend; return dividend / divisor; } There is a similar function for long. >> In Java 5 there is also unboxing, but we never updated gdb to know >> about that. Pierre> I almost never used Java, so I have no idea what unboxing means... A primitive type like 'int' has a corresponding object wrapper type, e.g., Integer. Unboxing means the compiler will automatically fetch the value from an object wrapper. I.e., this is valid: public int add5(Integer x) { return x + 5; } More than you ever wanted to know about Java, I'm sure :) Tom