This is the mail archive of the
mailing list for the Java project.
Re: FYI: Patch: java.net.InetAddress
- From: Bryce McKinlay <bryce at mckinlay dot net dot nz>
- To: Michael Koch <konqueror at gmx dot de>
- Cc: java-patches at gcc dot gnu dot org
- Date: Tue, 30 Sep 2003 09:49:02 +1200
- Subject: Re: FYI: Patch: java.net.InetAddress
On Monday, Sep 29, 2003, at 23:55 Pacific/Auckland, Michael Koch wrote:
I commited the attached patch to trunk to merge the comments of some
methods with classpath and to simplify isMulticastAddress().
RCS file: /cvs/gcc/gcc/libjava/java/net/InetAddress.java,v
retrieving revision 1.20
diff -u -b -B -r1.20 InetAddress.java
--- java/net/InetAddress.java 29 Sep 2003 11:24:28 -0000 1.20
+++ java/net/InetAddress.java 29 Sep 2003 11:39:32 -0000
@@ -140,12 +140,12 @@
public boolean isMulticastAddress()
- int len = addr.length;
- if (len == 4)
+ // Mask against high order bits of 1110
+ if (addr.length == 4)
return (addr  & 0xF0) == 0xE0;
Note that often, its is more efficient to copy a class field into a
local variable if it is going to be used more than once. This prevents
the field being reloaded in cases where the compiler can't guarantee
that it wont have changed due to, say, a method call in between.
In this case, however, the compiler is hopefully smart enough to
optimize out the second load, so it isn't a problem.
- if (len == 16)
+ // Mask against high order bits of 11111111
+ if (addr.lenth == 16)
return addr  == (byte) 0xFF;
^^ typo ?