# HG changeset patch # User timkelly # Date 1251399723 18000 # Node ID f17d142f8a47b9c07d8f2926a06678a1b22065ea # Parent 2d52d49686f6ace6d9ed67d52340c16227a8c28b# Parent 458fc58586935027dfcade12a2dbd9293374a288 merge commit diff -r 2d52d49686f6 -r f17d142f8a47 cdt/cdt_6_0_x/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32.java --- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32.java Thu Aug 27 14:01:23 2009 -0500 +++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32.java Thu Aug 27 14:02:03 2009 -0500 @@ -93,23 +93,15 @@ } public BigInteger distanceTo(IAddress other) { - if (!(other instanceof Addr32)) { - throw new IllegalArgumentException(); - } - return BigInteger.valueOf(((Addr32)other).address - address); + return other.getValue().subtract(getValue()); } public int compareTo(Object other) { - if (!(other instanceof Addr32)) { + if (!(other instanceof IAddress)) { throw new IllegalArgumentException(); } - if (address > ((Addr32)other).address) { - return 1; - } - if (address < ((Addr32)other).address) { - return -1; - } - return 0; + + return getValue().compareTo(((IAddress)other).getValue()); } public boolean isMax() { @@ -133,9 +125,9 @@ public boolean equals(Object x) { if (x == this) return true; - if (!(x instanceof Addr32)) + if (!(x instanceof IAddress)) return false; - return this.address == ((Addr32)x).address; + return getValue().equals(((IAddress)x).getValue()); } @Override diff -r 2d52d49686f6 -r f17d142f8a47 cdt/cdt_6_0_x/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64.java --- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64.java Thu Aug 27 14:01:23 2009 -0500 +++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64.java Thu Aug 27 14:02:03 2009 -0500 @@ -93,10 +93,7 @@ } public BigInteger distanceTo(IAddress other) { - if (! (other instanceof Addr64)) { - throw new IllegalArgumentException(); - } - return ((Addr64)other).address.add(address.negate()); + return other.getValue().subtract(getValue()); } public boolean isMax() { @@ -112,16 +109,20 @@ } public int compareTo(Object other) { - return this.address.compareTo(((Addr64)other).address); + if (!(other instanceof IAddress)) { + throw new IllegalArgumentException(); + } + + return getValue().compareTo(((IAddress)other).getValue()); } @Override public boolean equals(Object x) { if (x == this) return true; - if (! (x instanceof Addr64)) + if (!(x instanceof IAddress)) return false; - return this.address.equals(((Addr64)x).address); + return getValue().equals(((IAddress)x).getValue()); } @Override