198 */
199 public static long minValue(int bits) {
200 return CodeUtil.minValue(bits);
201 }
202
203 /**
204 * Get the maximum value representable in a {@code bits} bit signed integer.
205 */
206 public static long maxValue(int bits) {
207 return CodeUtil.maxValue(bits);
208 }
209
210 /**
211 * Get the maximum value representable in a {@code bits} bit unsigned integer.
212 */
213 public static long maxValueUnsigned(int bits) {
214 return getNbitNumberLong(bits);
215 }
216
217 public static long maxUnsigned(long a, long b) {
218 if (Long.compareUnsigned(a, b) > 0) {
219 return b;
220 }
221 return a;
222 }
223
224 public static long minUnsigned(long a, long b) {
225 if (Long.compareUnsigned(a, b) > 0) {
226 return a;
227 }
228 return b;
229 }
230
231 public static boolean sameSign(long a, long b) {
232 return a < 0 == b < 0;
233 }
234 }
|
198 */
199 public static long minValue(int bits) {
200 return CodeUtil.minValue(bits);
201 }
202
203 /**
204 * Get the maximum value representable in a {@code bits} bit signed integer.
205 */
206 public static long maxValue(int bits) {
207 return CodeUtil.maxValue(bits);
208 }
209
210 /**
211 * Get the maximum value representable in a {@code bits} bit unsigned integer.
212 */
213 public static long maxValueUnsigned(int bits) {
214 return getNbitNumberLong(bits);
215 }
216
217 public static long maxUnsigned(long a, long b) {
218 if (Long.compareUnsigned(a, b) < 0) {
219 return b;
220 }
221 return a;
222 }
223
224 public static long minUnsigned(long a, long b) {
225 if (Long.compareUnsigned(a, b) < 0) {
226 return a;
227 }
228 return b;
229 }
230
231 public static boolean sameSign(long a, long b) {
232 return a < 0 == b < 0;
233 }
234 }
|