This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Language extensions ?
- From: "Robin Garner" <robin dot garner at iname dot com>
- To: tromey at redhat dot com
- Cc: aph at redhat dot com, java at gcc dot gnu dot org
- Date: Sat, 29 Mar 2003 20:23:19 -0500
- Subject: Re: Language extensions ?
> >>>>> "Robin" == Robin Garner <robin dot garner at iname dot com>
writes:
>
> Robin> Sadly, the only way to compare signed integers in
an unsigned
> Robin> way is:
> Robin> boolean GT(int a, int b) {
> Robin> if( a > 0 && b > 0 || a < 0 && b < 0 )
> Robin> return a > b;
> Robin> else
> Robin> return a < b;
> Robin> }
>
> Sounds like a puzzle :-)
>
> How about
>
> boolean GT(int a, int b) {
> return (((long) a) & 0xffffffffL) > (((long) b) &
0xffffffffL);
> }
Nice try :) How about unsigned comparison on longs (for 64
bit architectures) ?
--
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup