49873
|
1 |
/*
|
58877
|
2 |
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
|
49873
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
50609
|
7 |
* published by the Free Software Foundation.
|
49873
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 |
* or visit www.oracle.com if you need additional information or have any
|
|
21 |
* questions.
|
|
22 |
*/
|
50858
|
23 |
|
|
24 |
|
52578
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
49873
|
41 |
package jdk.internal.vm.compiler.word;
|
|
42 |
|
|
43 |
/**
|
|
44 |
* Represents an unsigned word-sized value.
|
|
45 |
*
|
55509
|
46 |
* @since 19.0
|
49873
|
47 |
*/
|
|
48 |
public interface UnsignedWord extends ComparableWord {
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Returns a Unsigned whose value is {@code (this + val)}.
|
|
52 |
*
|
|
53 |
* @param val value to be added to this Unsigned.
|
|
54 |
* @return {@code this + val}
|
|
55 |
*
|
55509
|
56 |
* @since 19.0
|
49873
|
57 |
*/
|
|
58 |
UnsignedWord add(UnsignedWord val);
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Returns a Unsigned whose value is {@code (this - val)}.
|
|
62 |
*
|
|
63 |
* @param val value to be subtracted from this Unsigned.
|
|
64 |
* @return {@code this - val}
|
|
65 |
*
|
55509
|
66 |
* @since 19.0
|
49873
|
67 |
*/
|
|
68 |
UnsignedWord subtract(UnsignedWord val);
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Returns a Unsigned whose value is {@code (this * val)}.
|
|
72 |
*
|
|
73 |
* @param val value to be multiplied by this Unsigned.
|
|
74 |
* @return {@code this * val}
|
|
75 |
*
|
55509
|
76 |
* @since 19.0
|
49873
|
77 |
*/
|
|
78 |
UnsignedWord multiply(UnsignedWord val);
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Returns a Unsigned whose value is {@code (this / val)}.
|
|
82 |
*
|
|
83 |
* @param val value by which this Unsigned is to be divided.
|
|
84 |
* @return {@code this / val}
|
|
85 |
*
|
55509
|
86 |
* @since 19.0
|
49873
|
87 |
*/
|
|
88 |
UnsignedWord unsignedDivide(UnsignedWord val);
|
|
89 |
|
|
90 |
/**
|
|
91 |
* Returns a Unsigned whose value is {@code (this % val)}.
|
|
92 |
*
|
|
93 |
* @param val value by which this Unsigned is to be divided, and the remainder computed.
|
|
94 |
* @return {@code this % val}
|
|
95 |
*
|
55509
|
96 |
* @since 19.0
|
49873
|
97 |
*/
|
|
98 |
UnsignedWord unsignedRemainder(UnsignedWord val);
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Returns a Unsigned whose value is {@code (this << n)}.
|
|
102 |
*
|
|
103 |
* @param n shift distance, in bits.
|
|
104 |
* @return {@code this << n}
|
|
105 |
*
|
55509
|
106 |
* @since 19.0
|
49873
|
107 |
*/
|
|
108 |
UnsignedWord shiftLeft(UnsignedWord n);
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Returns a Unsigned whose value is {@code (this >>> n)}. No sign extension is performed.
|
|
112 |
*
|
|
113 |
* @param n shift distance, in bits.
|
|
114 |
* @return {@code this >> n}
|
|
115 |
*
|
55509
|
116 |
* @since 19.0
|
49873
|
117 |
*/
|
|
118 |
UnsignedWord unsignedShiftRight(UnsignedWord n);
|
|
119 |
|
|
120 |
/**
|
|
121 |
* Returns a Unsigned whose value is {@code (this & val)}.
|
|
122 |
*
|
|
123 |
* @param val value to be AND'ed with this Unsigned.
|
|
124 |
* @return {@code this & val}
|
|
125 |
*
|
55509
|
126 |
* @since 19.0
|
49873
|
127 |
*/
|
|
128 |
UnsignedWord and(UnsignedWord val);
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Returns a Unsigned whose value is {@code (this | val)}.
|
|
132 |
*
|
|
133 |
* @param val value to be OR'ed with this Unsigned.
|
|
134 |
* @return {@code this | val}
|
|
135 |
*
|
55509
|
136 |
* @since 19.0
|
49873
|
137 |
*/
|
|
138 |
UnsignedWord or(UnsignedWord val);
|
|
139 |
|
|
140 |
/**
|
|
141 |
* Returns a Unsigned whose value is {@code (this ^ val)}.
|
|
142 |
*
|
|
143 |
* @param val value to be XOR'ed with this Unsigned.
|
|
144 |
* @return {@code this ^ val}
|
|
145 |
*
|
55509
|
146 |
* @since 19.0
|
49873
|
147 |
*/
|
|
148 |
UnsignedWord xor(UnsignedWord val);
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Returns a Unsigned whose value is {@code (~this)}.
|
|
152 |
*
|
|
153 |
* @return {@code ~this}
|
|
154 |
*
|
55509
|
155 |
* @since 19.0
|
49873
|
156 |
*/
|
|
157 |
UnsignedWord not();
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Compares this Unsigned with the specified value.
|
|
161 |
*
|
|
162 |
* @param val value to which this Unsigned is to be compared.
|
|
163 |
* @return {@code this == val}
|
|
164 |
*
|
55509
|
165 |
* @since 19.0
|
49873
|
166 |
*/
|
|
167 |
boolean equal(UnsignedWord val);
|
|
168 |
|
|
169 |
/**
|
|
170 |
* Compares this Unsigned with the specified value.
|
|
171 |
*
|
|
172 |
* @param val value to which this Unsigned is to be compared.
|
|
173 |
* @return {@code this != val}
|
|
174 |
*
|
55509
|
175 |
* @since 19.0
|
49873
|
176 |
*/
|
|
177 |
boolean notEqual(UnsignedWord val);
|
|
178 |
|
|
179 |
/**
|
|
180 |
* Compares this Unsigned with the specified value.
|
|
181 |
*
|
|
182 |
* @param val value to which this Unsigned is to be compared.
|
|
183 |
* @return {@code this < val}
|
|
184 |
*
|
55509
|
185 |
* @since 19.0
|
49873
|
186 |
*/
|
|
187 |
boolean belowThan(UnsignedWord val);
|
|
188 |
|
|
189 |
/**
|
|
190 |
* Compares this Unsigned with the specified value.
|
|
191 |
*
|
|
192 |
* @param val value to which this Unsigned is to be compared.
|
|
193 |
* @return {@code this <= val}
|
|
194 |
*
|
55509
|
195 |
* @since 19.0
|
49873
|
196 |
*/
|
|
197 |
boolean belowOrEqual(UnsignedWord val);
|
|
198 |
|
|
199 |
/**
|
|
200 |
* Compares this Unsigned with the specified value.
|
|
201 |
*
|
|
202 |
* @param val value to which this Unsigned is to be compared.
|
|
203 |
* @return {@code this > val}
|
|
204 |
*
|
55509
|
205 |
* @since 19.0
|
49873
|
206 |
*/
|
|
207 |
boolean aboveThan(UnsignedWord val);
|
|
208 |
|
|
209 |
/**
|
|
210 |
* Compares this Unsigned with the specified value.
|
|
211 |
*
|
|
212 |
* @param val value to which this Unsigned is to be compared.
|
|
213 |
* @return {@code this >= val}
|
|
214 |
*
|
55509
|
215 |
* @since 19.0
|
49873
|
216 |
*/
|
|
217 |
boolean aboveOrEqual(UnsignedWord val);
|
|
218 |
|
|
219 |
/**
|
|
220 |
* Returns a Unsigned whose value is {@code (this + val)}.
|
|
221 |
* <p>
|
|
222 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
223 |
* Therefore, the result is only well-defined for positive right operands.
|
|
224 |
*
|
|
225 |
* @param val value to be added to this Unsigned.
|
|
226 |
* @return {@code this + val}
|
|
227 |
*
|
55509
|
228 |
* @since 19.0
|
49873
|
229 |
*/
|
|
230 |
UnsignedWord add(int val);
|
|
231 |
|
|
232 |
/**
|
|
233 |
* Returns a Unsigned whose value is {@code (this - val)}.
|
|
234 |
* <p>
|
|
235 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
236 |
* Therefore, the result is only well-defined for positive right operands.
|
|
237 |
*
|
|
238 |
* @param val value to be subtracted from this Unsigned.
|
|
239 |
* @return {@code this - val}
|
|
240 |
*
|
55509
|
241 |
* @since 19.0
|
49873
|
242 |
*/
|
|
243 |
UnsignedWord subtract(int val);
|
|
244 |
|
|
245 |
/**
|
|
246 |
* Returns a Unsigned whose value is {@code (this * val)}.
|
|
247 |
* <p>
|
|
248 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
249 |
* Therefore, the result is only well-defined for positive right operands.
|
|
250 |
*
|
|
251 |
* @param val value to be multiplied by this Unsigned.
|
|
252 |
* @return {@code this * val}
|
|
253 |
*
|
55509
|
254 |
* @since 19.0
|
49873
|
255 |
*/
|
|
256 |
UnsignedWord multiply(int val);
|
|
257 |
|
|
258 |
/**
|
|
259 |
* Returns a Unsigned whose value is {@code (this / val)}.
|
|
260 |
* <p>
|
|
261 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
262 |
* Therefore, the result is only well-defined for positive right operands.
|
|
263 |
*
|
|
264 |
* @param val value by which this Unsigned is to be divided.
|
|
265 |
* @return {@code this / val}
|
|
266 |
*
|
55509
|
267 |
* @since 19.0
|
49873
|
268 |
*/
|
|
269 |
UnsignedWord unsignedDivide(int val);
|
|
270 |
|
|
271 |
/**
|
|
272 |
* Returns a Unsigned whose value is {@code (this % val)}.
|
|
273 |
* <p>
|
|
274 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
275 |
* Therefore, the result is only well-defined for positive right operands.
|
|
276 |
*
|
|
277 |
* @param val value by which this Unsigned is to be divided, and the remainder computed.
|
|
278 |
* @return {@code this % val}
|
|
279 |
*
|
55509
|
280 |
* @since 19.0
|
49873
|
281 |
*/
|
|
282 |
UnsignedWord unsignedRemainder(int val);
|
|
283 |
|
|
284 |
/**
|
|
285 |
* Returns a Unsigned whose value is {@code (this << n)}.
|
|
286 |
* <p>
|
|
287 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
288 |
* Therefore, the result is only well-defined for positive right operands.
|
|
289 |
*
|
|
290 |
* @param n shift distance, in bits.
|
|
291 |
* @return {@code this << n}
|
|
292 |
*
|
55509
|
293 |
* @since 19.0
|
49873
|
294 |
*/
|
|
295 |
UnsignedWord shiftLeft(int n);
|
|
296 |
|
|
297 |
/**
|
|
298 |
* Returns a Unsigned whose value is {@code (this >>> n)}. No sign extension is performed.
|
|
299 |
* <p>
|
|
300 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
301 |
* Therefore, the result is only well-defined for positive right operands.
|
|
302 |
*
|
|
303 |
* @param n shift distance, in bits.
|
|
304 |
* @return {@code this >> n}
|
|
305 |
*
|
55509
|
306 |
* @since 19.0
|
49873
|
307 |
*/
|
|
308 |
UnsignedWord unsignedShiftRight(int n);
|
|
309 |
|
|
310 |
/**
|
|
311 |
* Returns a Unsigned whose value is {@code (this & val)}.
|
|
312 |
* <p>
|
|
313 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
314 |
* Therefore, the result is only well-defined for positive right operands.
|
|
315 |
*
|
|
316 |
* @param val value to be AND'ed with this Unsigned.
|
|
317 |
* @return {@code this & val}
|
|
318 |
*
|
55509
|
319 |
* @since 19.0
|
49873
|
320 |
*/
|
|
321 |
UnsignedWord and(int val);
|
|
322 |
|
|
323 |
/**
|
|
324 |
* Returns a Unsigned whose value is {@code (this | val)}.
|
|
325 |
* <p>
|
|
326 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
327 |
* Therefore, the result is only well-defined for positive right operands.
|
|
328 |
*
|
|
329 |
* @param val value to be OR'ed with this Unsigned.
|
|
330 |
* @return {@code this | val}
|
|
331 |
*
|
55509
|
332 |
* @since 19.0
|
49873
|
333 |
*/
|
|
334 |
UnsignedWord or(int val);
|
|
335 |
|
|
336 |
/**
|
|
337 |
* Returns a Unsigned whose value is {@code (this ^ val)}.
|
|
338 |
* <p>
|
|
339 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
340 |
* Therefore, the result is only well-defined for positive right operands.
|
|
341 |
*
|
|
342 |
* @param val value to be XOR'ed with this Unsigned.
|
|
343 |
* @return {@code this ^ val}
|
|
344 |
*
|
55509
|
345 |
* @since 19.0
|
49873
|
346 |
*/
|
|
347 |
UnsignedWord xor(int val);
|
|
348 |
|
|
349 |
/**
|
|
350 |
* Compares this Unsigned with the specified value.
|
|
351 |
* <p>
|
|
352 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
353 |
* Therefore, the result is only well-defined for positive right operands.
|
|
354 |
*
|
|
355 |
* @param val value to which this Unsigned is to be compared.
|
|
356 |
* @return {@code this == val}
|
|
357 |
*
|
55509
|
358 |
* @since 19.0
|
49873
|
359 |
*/
|
|
360 |
boolean equal(int val);
|
|
361 |
|
|
362 |
/**
|
|
363 |
* Compares this Unsigned with the specified value.
|
|
364 |
* <p>
|
|
365 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
366 |
* Therefore, the result is only well-defined for positive right operands.
|
|
367 |
*
|
|
368 |
* @param val value to which this Unsigned is to be compared.
|
|
369 |
* @return {@code this != val}
|
|
370 |
*
|
55509
|
371 |
* @since 19.0
|
49873
|
372 |
*/
|
|
373 |
boolean notEqual(int val);
|
|
374 |
|
|
375 |
/**
|
|
376 |
* Compares this Unsigned with the specified value.
|
|
377 |
* <p>
|
|
378 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
379 |
* Therefore, the result is only well-defined for positive right operands.
|
|
380 |
*
|
|
381 |
* @param val value to which this Unsigned is to be compared.
|
|
382 |
* @return {@code this < val}
|
|
383 |
*
|
55509
|
384 |
* @since 19.0
|
49873
|
385 |
*/
|
|
386 |
boolean belowThan(int val);
|
|
387 |
|
|
388 |
/**
|
|
389 |
* Compares this Unsigned with the specified value.
|
|
390 |
* <p>
|
|
391 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
392 |
* Therefore, the result is only well-defined for positive right operands.
|
|
393 |
*
|
|
394 |
* @param val value to which this Unsigned is to be compared.
|
|
395 |
* @return {@code this <= val}
|
|
396 |
*
|
55509
|
397 |
* @since 19.0
|
49873
|
398 |
*/
|
|
399 |
boolean belowOrEqual(int val);
|
|
400 |
|
|
401 |
/**
|
|
402 |
* Compares this Unsigned with the specified value.
|
|
403 |
* <p>
|
|
404 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
405 |
* Therefore, the result is only well-defined for positive right operands.
|
|
406 |
*
|
|
407 |
* @param val value to which this Unsigned is to be compared.
|
|
408 |
* @return {@code this > val}
|
|
409 |
*
|
55509
|
410 |
* @since 19.0
|
49873
|
411 |
*/
|
|
412 |
boolean aboveThan(int val);
|
|
413 |
|
|
414 |
/**
|
|
415 |
* Compares this Unsigned with the specified value.
|
|
416 |
* <p>
|
|
417 |
* Note that the right operand is a signed value, while the operation is performed unsigned.
|
|
418 |
* Therefore, the result is only well-defined for positive right operands.
|
|
419 |
*
|
|
420 |
* @param val value to which this Unsigned is to be compared.
|
|
421 |
* @return {@code this >= val}
|
|
422 |
*
|
55509
|
423 |
* @since 19.0
|
49873
|
424 |
*/
|
|
425 |
boolean aboveOrEqual(int val);
|
|
426 |
}
|