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 a signed word-sized value.
|
|
45 |
*
|
55509
|
46 |
* @since 19.0
|
49873
|
47 |
*/
|
|
48 |
public interface SignedWord extends ComparableWord {
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Returns a Signed whose value is {@code (this + val)}.
|
|
52 |
*
|
|
53 |
* @param val value to be added to this Signed.
|
|
54 |
* @return {@code this + val}
|
|
55 |
*
|
55509
|
56 |
* @since 19.0
|
49873
|
57 |
*/
|
|
58 |
SignedWord add(SignedWord val);
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Returns a Signed whose value is {@code (this - val)}.
|
|
62 |
*
|
|
63 |
* @param val value to be subtracted from this Signed.
|
|
64 |
* @return {@code this - val}
|
|
65 |
*
|
55509
|
66 |
* @since 19.0
|
49873
|
67 |
*/
|
|
68 |
SignedWord subtract(SignedWord val);
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Returns a Signed whose value is {@code (this * val)}.
|
|
72 |
*
|
|
73 |
* @param val value to be multiplied by this Signed.
|
|
74 |
* @return {@code this * val}
|
|
75 |
*
|
55509
|
76 |
* @since 19.0
|
49873
|
77 |
*/
|
|
78 |
SignedWord multiply(SignedWord val);
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Returns a Signed whose value is {@code (this / val)}.
|
|
82 |
*
|
|
83 |
* @param val value by which this Signed is to be divided.
|
|
84 |
* @return {@code this / val}
|
|
85 |
*
|
55509
|
86 |
* @since 19.0
|
49873
|
87 |
*/
|
|
88 |
SignedWord signedDivide(SignedWord val);
|
|
89 |
|
|
90 |
/**
|
|
91 |
* Returns a Signed whose value is {@code (this % val)}.
|
|
92 |
*
|
|
93 |
* @param val value by which this Signed is to be divided, and the remainder computed.
|
|
94 |
* @return {@code this % val}
|
|
95 |
*
|
55509
|
96 |
* @since 19.0
|
49873
|
97 |
*/
|
|
98 |
SignedWord signedRemainder(SignedWord val);
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Returns a Signed 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 |
SignedWord shiftLeft(UnsignedWord n);
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Returns a Signed whose value is {@code (this >> n)}. 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 |
SignedWord signedShiftRight(UnsignedWord n);
|
|
119 |
|
|
120 |
/**
|
|
121 |
* Returns a Signed whose value is {@code (this & val)}. (This method returns a negative Signed
|
|
122 |
* if and only if this and val are both negative.)
|
|
123 |
*
|
|
124 |
* @param val value to be AND'ed with this Signed.
|
|
125 |
* @return {@code this & val}
|
|
126 |
*
|
55509
|
127 |
* @since 19.0
|
49873
|
128 |
*/
|
|
129 |
SignedWord and(SignedWord val);
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Returns a Signed whose value is {@code (this | val)}. (This method returns a negative Signed
|
|
133 |
* if and only if either this or val is negative.)
|
|
134 |
*
|
|
135 |
* @param val value to be OR'ed with this Signed.
|
|
136 |
* @return {@code this | val}
|
|
137 |
*
|
55509
|
138 |
* @since 19.0
|
49873
|
139 |
*/
|
|
140 |
SignedWord or(SignedWord val);
|
|
141 |
|
|
142 |
/**
|
|
143 |
* Returns a Signed whose value is {@code (this ^ val)}. (This method returns a negative Signed
|
|
144 |
* if and only if exactly one of this and val are negative.)
|
|
145 |
*
|
|
146 |
* @param val value to be XOR'ed with this Signed.
|
|
147 |
* @return {@code this ^ val}
|
|
148 |
*
|
55509
|
149 |
* @since 19.0
|
49873
|
150 |
*/
|
|
151 |
SignedWord xor(SignedWord val);
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Returns a Signed whose value is {@code (~this)}. (This method returns a negative value if and
|
|
155 |
* only if this Signed is non-negative.)
|
|
156 |
*
|
|
157 |
* @return {@code ~this}
|
|
158 |
*
|
55509
|
159 |
* @since 19.0
|
49873
|
160 |
*/
|
|
161 |
SignedWord not();
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Compares this Signed with the specified value.
|
|
165 |
*
|
|
166 |
* @param val value to which this Signed is to be compared.
|
|
167 |
* @return {@code this == val}
|
|
168 |
*
|
55509
|
169 |
* @since 19.0
|
49873
|
170 |
*/
|
|
171 |
boolean equal(SignedWord val);
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Compares this Signed with the specified value.
|
|
175 |
*
|
|
176 |
* @param val value to which this Signed is to be compared.
|
|
177 |
* @return {@code this != val}
|
|
178 |
*
|
55509
|
179 |
* @since 19.0
|
49873
|
180 |
*/
|
|
181 |
boolean notEqual(SignedWord val);
|
|
182 |
|
|
183 |
/**
|
|
184 |
* Compares this Signed with the specified value.
|
|
185 |
*
|
|
186 |
* @param val value to which this Signed is to be compared.
|
|
187 |
* @return {@code this < val}
|
|
188 |
*
|
55509
|
189 |
* @since 19.0
|
49873
|
190 |
*/
|
|
191 |
boolean lessThan(SignedWord val);
|
|
192 |
|
|
193 |
/**
|
|
194 |
* Compares this Signed with the specified value.
|
|
195 |
*
|
|
196 |
* @param val value to which this Signed is to be compared.
|
|
197 |
* @return {@code this <= val}
|
|
198 |
*
|
55509
|
199 |
* @since 19.0
|
49873
|
200 |
*/
|
|
201 |
boolean lessOrEqual(SignedWord val);
|
|
202 |
|
|
203 |
/**
|
|
204 |
* Compares this Signed with the specified value.
|
|
205 |
*
|
|
206 |
* @param val value to which this Signed is to be compared.
|
|
207 |
* @return {@code this > val}
|
|
208 |
*
|
55509
|
209 |
* @since 19.0
|
49873
|
210 |
*/
|
|
211 |
boolean greaterThan(SignedWord val);
|
|
212 |
|
|
213 |
/**
|
|
214 |
* Compares this Signed with the specified value.
|
|
215 |
*
|
|
216 |
* @param val value to which this Signed is to be compared.
|
|
217 |
* @return {@code this >= val}
|
|
218 |
*
|
55509
|
219 |
* @since 19.0
|
49873
|
220 |
*/
|
|
221 |
boolean greaterOrEqual(SignedWord val);
|
|
222 |
|
|
223 |
/**
|
|
224 |
* Returns a Signed whose value is {@code (this + val)}.
|
|
225 |
*
|
|
226 |
* @param val value to be added to this Signed.
|
|
227 |
* @return {@code this + val}
|
|
228 |
*
|
55509
|
229 |
* @since 19.0
|
49873
|
230 |
*/
|
|
231 |
SignedWord add(int val);
|
|
232 |
|
|
233 |
/**
|
|
234 |
* Returns a Signed whose value is {@code (this - val)}.
|
|
235 |
*
|
|
236 |
* @param val value to be subtracted from this Signed.
|
|
237 |
* @return {@code this - val}
|
|
238 |
*
|
55509
|
239 |
* @since 19.0
|
49873
|
240 |
*/
|
|
241 |
SignedWord subtract(int val);
|
|
242 |
|
|
243 |
/**
|
|
244 |
* Returns a Signed whose value is {@code (this * val)}.
|
|
245 |
*
|
|
246 |
* @param val value to be multiplied by this Signed.
|
|
247 |
* @return {@code this * val}
|
|
248 |
*
|
55509
|
249 |
* @since 19.0
|
49873
|
250 |
*/
|
|
251 |
SignedWord multiply(int val);
|
|
252 |
|
|
253 |
/**
|
|
254 |
* Returns a Signed whose value is {@code (this / val)}.
|
|
255 |
*
|
|
256 |
* @param val value by which this Signed is to be divided.
|
|
257 |
* @return {@code this / val}
|
|
258 |
*
|
55509
|
259 |
* @since 19.0
|
49873
|
260 |
*/
|
|
261 |
SignedWord signedDivide(int val);
|
|
262 |
|
|
263 |
/**
|
|
264 |
* Returns a Signed whose value is {@code (this % val)}.
|
|
265 |
*
|
|
266 |
* @param val value by which this Signed is to be divided, and the remainder computed.
|
|
267 |
* @return {@code this % val}
|
|
268 |
*
|
55509
|
269 |
* @since 19.0
|
49873
|
270 |
*/
|
|
271 |
SignedWord signedRemainder(int val);
|
|
272 |
|
|
273 |
/**
|
|
274 |
* Returns a Signed whose value is {@code (this << n)}.
|
|
275 |
*
|
|
276 |
* @param n shift distance, in bits.
|
|
277 |
* @return {@code this << n}
|
|
278 |
*
|
55509
|
279 |
* @since 19.0
|
49873
|
280 |
*/
|
|
281 |
SignedWord shiftLeft(int n);
|
|
282 |
|
|
283 |
/**
|
|
284 |
* Returns a Signed whose value is {@code (this >> n)}. Sign extension is performed.
|
|
285 |
*
|
|
286 |
* @param n shift distance, in bits.
|
|
287 |
* @return {@code this >> n}
|
|
288 |
*
|
55509
|
289 |
* @since 19.0
|
49873
|
290 |
*/
|
|
291 |
SignedWord signedShiftRight(int n);
|
|
292 |
|
|
293 |
/**
|
|
294 |
* Returns a Signed whose value is {@code (this & val)}. (This method returns a negative Signed
|
|
295 |
* if and only if this and val are both negative.)
|
|
296 |
*
|
|
297 |
* @param val value to be AND'ed with this Signed.
|
|
298 |
* @return {@code this & val}
|
|
299 |
*
|
55509
|
300 |
* @since 19.0
|
49873
|
301 |
*/
|
|
302 |
SignedWord and(int val);
|
|
303 |
|
|
304 |
/**
|
|
305 |
* Returns a Signed whose value is {@code (this | val)}. (This method returns a negative Signed
|
|
306 |
* if and only if either this or val is negative.)
|
|
307 |
*
|
|
308 |
* @param val value to be OR'ed with this Signed.
|
|
309 |
* @return {@code this | val}
|
|
310 |
*
|
55509
|
311 |
* @since 19.0
|
49873
|
312 |
*/
|
|
313 |
SignedWord or(int val);
|
|
314 |
|
|
315 |
/**
|
|
316 |
* Returns a Signed whose value is {@code (this ^ val)}. (This method returns a negative Signed
|
|
317 |
* if and only if exactly one of this and val are negative.)
|
|
318 |
*
|
|
319 |
* @param val value to be XOR'ed with this Signed.
|
|
320 |
* @return {@code this ^ val}
|
|
321 |
*
|
55509
|
322 |
* @since 19.0
|
49873
|
323 |
*/
|
|
324 |
SignedWord xor(int val);
|
|
325 |
|
|
326 |
/**
|
|
327 |
* Compares this Signed with the specified value.
|
|
328 |
*
|
|
329 |
* @param val value to which this Signed is to be compared.
|
|
330 |
* @return {@code this == val}
|
|
331 |
*
|
55509
|
332 |
* @since 19.0
|
49873
|
333 |
*/
|
|
334 |
boolean equal(int val);
|
|
335 |
|
|
336 |
/**
|
|
337 |
* Compares this Signed with the specified value.
|
|
338 |
*
|
|
339 |
* @param val value to which this Signed is to be compared.
|
|
340 |
* @return {@code this != val}
|
|
341 |
*
|
55509
|
342 |
* @since 19.0
|
49873
|
343 |
*/
|
|
344 |
boolean notEqual(int val);
|
|
345 |
|
|
346 |
/**
|
|
347 |
* Compares this Signed with the specified value.
|
|
348 |
*
|
|
349 |
* @param val value to which this Signed is to be compared.
|
|
350 |
* @return {@code this < val}
|
|
351 |
*
|
55509
|
352 |
* @since 19.0
|
49873
|
353 |
*/
|
|
354 |
boolean lessThan(int val);
|
|
355 |
|
|
356 |
/**
|
|
357 |
* Compares this Signed with the specified value.
|
|
358 |
*
|
|
359 |
* @param val value to which this Signed is to be compared.
|
|
360 |
* @return {@code this <= val}
|
|
361 |
*
|
55509
|
362 |
* @since 19.0
|
49873
|
363 |
*/
|
|
364 |
boolean lessOrEqual(int val);
|
|
365 |
|
|
366 |
/**
|
|
367 |
* Compares this Signed with the specified value.
|
|
368 |
*
|
|
369 |
* @param val value to which this Signed is to be compared.
|
|
370 |
* @return {@code this > val}
|
|
371 |
*
|
55509
|
372 |
* @since 19.0
|
49873
|
373 |
*/
|
|
374 |
boolean greaterThan(int val);
|
|
375 |
|
|
376 |
/**
|
|
377 |
* Compares this Signed with the specified value.
|
|
378 |
*
|
|
379 |
* @param val value to which this Signed is to be compared.
|
|
380 |
* @return {@code this >= val}
|
|
381 |
*
|
55509
|
382 |
* @since 19.0
|
49873
|
383 |
*/
|
|
384 |
boolean greaterOrEqual(int val);
|
|
385 |
}
|