@@ -46,12 +46,12 @@ protected Address() {
4646
4747 @ INLINE
4848 public static Address zero () {
49- return isHosted () ? BoxedAddress . ZERO : fromInt (0 );
49+ return fromInt (0 );
5050 }
5151
5252 @ INLINE
5353 public static Address max () {
54- return isHosted () ? BoxedAddress . MAX : fromLong (-1L );
54+ return fromLong (-1L );
5555 }
5656
5757 /**
@@ -63,11 +63,6 @@ public static Address max() {
6363 */
6464 @ INLINE
6565 public static Address fromUnsignedInt (int value ) {
66- if (isHosted ()) {
67- final long longValue = value ;
68- final long n = longValue & 0xffffffffL ;
69- return BoxedAddress .from (n );
70- }
7166 if (Word .width () == 64 ) {
7267 final long longValue = value ;
7368 final long n = longValue & 0xffffffffL ;
@@ -85,10 +80,6 @@ public static Address fromUnsignedInt(int value) {
8580 */
8681 @ INLINE
8782 public static Address fromInt (int value ) {
88- if (isHosted ()) {
89- final long n = value ;
90- return BoxedAddress .from (n );
91- }
9283 if (Word .width () == 64 ) {
9384 final long n = value ;
9485 return UnsafeCast .asAddress (n );
@@ -98,9 +89,6 @@ public static Address fromInt(int value) {
9889
9990 @ INLINE
10091 public static Address fromLong (long value ) {
101- if (isHosted ()) {
102- return BoxedAddress .from (value );
103- }
10492 if (Word .width () == 64 ) {
10593 return UnsafeCast .asAddress (value );
10694 }
@@ -161,10 +149,6 @@ public static Address parse(String s, int radix) {
161149
162150 @ INLINE
163151 public final int toInt () {
164- if (isHosted ()) {
165- final Boxed box = (Boxed ) this ;
166- return (int ) box .value ();
167- }
168152 if (Word .width () == 64 ) {
169153 final long n = UnsafeCast .asLong (this );
170154 return (int ) n ;
@@ -174,87 +158,17 @@ public final int toInt() {
174158
175159 @ INLINE
176160 public final long toLong () {
177- if (isHosted ()) {
178- final Boxed box = (Boxed ) this ;
179- return box .value ();
180- }
181161 if (Word .width () == 64 ) {
182162 return UnsafeCast .asLong (this );
183163 }
184164 return 0xffffffffL & UnsafeCast .asInt (this );
185165 }
186166
187- public final int compareTo (Address other ) {
188- if (greaterThan (other )) {
189- return 1 ;
190- }
191- if (lessThan (other )) {
192- return -1 ;
193- }
194- return 0 ;
195- }
196-
197167 @ INLINE
198168 public final boolean equals (int other ) {
199- if (isHosted ()) {
200- return toLong () == other ;
201- }
202169 return fromInt (other ) == this ;
203170 }
204171
205- @ BUILTIN (value = AddressBuiltin .GreaterThan .class )
206- @ INTRINSIC (UWCMP | (ABOVE_THAN << 8 ))
207- public final boolean greaterThan (Address other ) {
208- assert isHosted ();
209- final long a = toLong ();
210- final long b = other .toLong ();
211- if (a < 0 == b < 0 ) {
212- return a > b ;
213- }
214- return a < b ;
215- }
216-
217- @ INLINE (override = true )
218- public final boolean greaterThan (int other ) {
219- return greaterThan (fromInt (other ));
220- }
221-
222- @ BUILTIN (value = AddressBuiltin .GreaterEqual .class )
223- @ INTRINSIC (UWCMP | (ABOVE_EQUAL << 8 ))
224- public final boolean greaterEqual (Address other ) {
225- assert isHosted ();
226- return !other .greaterThan (this );
227- }
228-
229- @ INLINE (override = true )
230- public final boolean greaterEqual (int other ) {
231- return greaterEqual (fromInt (other ));
232- }
233-
234- @ BUILTIN (value = AddressBuiltin .LessThan .class )
235- @ INTRINSIC (UWCMP | (BELOW_THAN << 8 ))
236- public final boolean lessThan (Address other ) {
237- assert isHosted ();
238- return other .greaterThan (this );
239- }
240-
241- @ INLINE (override = true )
242- public final boolean lessThan (int other ) {
243- return lessThan (fromInt (other ));
244- }
245-
246- @ BUILTIN (value = AddressBuiltin .LessEqual .class )
247- @ INTRINSIC (UWCMP | (BELOW_EQUAL << 8 ))
248- public final boolean lessEqual (Address other ) {
249- assert isHosted ();
250- return !greaterThan (other );
251- }
252-
253- @ INLINE (override = true )
254- public final boolean lessEqual (int other ) {
255- return lessEqual (fromInt (other ));
256- }
257-
258172 @ INLINE (override = true )
259173 public Address plus (Address addend ) {
260174 return asOffset ().plus (addend .asOffset ()).asAddress ();
0 commit comments