From 871cadaa2bc471885dfdc47325b87371e569d0fd Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Mon, 10 Aug 2020 21:22:26 -0700 Subject: [PATCH] Moved BitConstraints#isUnsigned to BitUtils --- core/src/com/riiablo/io/BitConstraints.java | 5 ----- core/src/com/riiablo/io/BitInput.java | 8 ++++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/core/src/com/riiablo/io/BitConstraints.java b/core/src/com/riiablo/io/BitConstraints.java index c24b74ef..f134a08c 100644 --- a/core/src/com/riiablo/io/BitConstraints.java +++ b/core/src/com/riiablo/io/BitConstraints.java @@ -56,11 +56,6 @@ class BitConstraints { return validateSize(Long.SIZE, bits); } - public static boolean isUnsigned(long value, int size) { - assert 0 < size && size <= Long.SIZE; - return (value & (1 << (size - 1))) == 0; - } - public static int validateAscii(int bits) { return _validateSize(Byte.SIZE - 1, Byte.SIZE, bits); } diff --git a/core/src/com/riiablo/io/BitInput.java b/core/src/com/riiablo/io/BitInput.java index 76980c32..d2772a01 100644 --- a/core/src/com/riiablo/io/BitInput.java +++ b/core/src/com/riiablo/io/BitInput.java @@ -304,7 +304,7 @@ public class BitInput { public byte read7u(int bits) { BitConstraints.validate7u(bits); final byte value = (byte) readUnsigned(bits); - assert BitConstraints.isUnsigned(value, Byte.SIZE); + assert BitUtils.isUnsigned(value); return value; } @@ -315,7 +315,7 @@ public class BitInput { public short read15u(int bits) { BitConstraints.validate15u(bits); final short value = (short) readUnsigned(bits); - assert BitConstraints.isUnsigned(value, Short.SIZE); + assert BitUtils.isUnsigned(value); return value; } @@ -326,7 +326,7 @@ public class BitInput { public int read31u(int bits) { BitConstraints.validate31u(bits); final int value = (int) readUnsigned(bits); - assert BitConstraints.isUnsigned(value, Integer.SIZE); + assert BitUtils.isUnsigned(value); return value; } @@ -337,7 +337,7 @@ public class BitInput { public long read63u(int bits) { BitConstraints.validate63u(bits); final long value = (long) readUnsigned(bits); - assert BitConstraints.isUnsigned(value, Long.SIZE); + assert BitUtils.isUnsigned(value); return value; }