From 088cde3b9e78f0ead4ec1dcb897fdfefc44a6794 Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Tue, 11 Aug 2020 17:56:40 -0700 Subject: [PATCH] Ranamed SafeUnsigned to UnsafeNarrowing --- core/src/com/riiablo/io/BitConstraints.java | 8 ++++---- core/src/com/riiablo/io/ByteInput.java | 8 ++++---- .../io/{SafeUnsigned.java => UnsafeNarrowing.java} | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) rename core/src/com/riiablo/io/{SafeUnsigned.java => UnsafeNarrowing.java} (61%) diff --git a/core/src/com/riiablo/io/BitConstraints.java b/core/src/com/riiablo/io/BitConstraints.java index e9cb8579..1bec93c2 100644 --- a/core/src/com/riiablo/io/BitConstraints.java +++ b/core/src/com/riiablo/io/BitConstraints.java @@ -62,7 +62,7 @@ class BitConstraints { public static byte safe8u(short i) { if (!BitUtils.isUnsigned(i, Byte.SIZE)) { - throw new SafeUnsigned(i); + throw new UnsafeNarrowing(i); } return (byte) i; @@ -70,7 +70,7 @@ class BitConstraints { public static short safe16u(int i) { if (!BitUtils.isUnsigned(i, Short.SIZE)) { - throw new SafeUnsigned(i); + throw new UnsafeNarrowing(i); } return (short) i; @@ -78,7 +78,7 @@ class BitConstraints { public static int safe32u(long i) { if (!BitUtils.isUnsigned(i, Integer.SIZE)) { - throw new SafeUnsigned(i); + throw new UnsafeNarrowing(i); } return (int) i; @@ -86,7 +86,7 @@ class BitConstraints { public static long safe64u(long i) { if (!BitUtils.isUnsigned(i, Long.SIZE)) { - throw new SafeUnsigned(i); + throw new UnsafeNarrowing(i); } return (long) i; diff --git a/core/src/com/riiablo/io/ByteInput.java b/core/src/com/riiablo/io/ByteInput.java index 085e0392..81747935 100644 --- a/core/src/com/riiablo/io/ByteInput.java +++ b/core/src/com/riiablo/io/ByteInput.java @@ -288,7 +288,7 @@ public class ByteInput { /** * Reads an unsigned byte as a {@code byte}. * - * @throws SafeUnsigned if the read value is larger than 7 bits. + * @throws UnsafeNarrowing if the read value is larger than 7 bits. * * @see #read8u() */ @@ -306,7 +306,7 @@ public class ByteInput { /** * Reads an unsigned 16-bit short integer as a {@code short}. * - * @throws SafeUnsigned if the read value is larger than 15 bits. + * @throws UnsafeNarrowing if the read value is larger than 15 bits. * * @see #read16u() */ @@ -324,7 +324,7 @@ public class ByteInput { /** * Reads an unsigned 32-bit integer as an {@code int}. * - * @throws SafeUnsigned if the read value is larger than 31 bits. + * @throws UnsafeNarrowing if the read value is larger than 31 bits. * * @see #read32u() */ @@ -342,7 +342,7 @@ public class ByteInput { /** * Reads an unsigned 64-bit long integer as a {@code long}. * - * @throws SafeUnsigned if the read value is larger than 63 bits. + * @throws UnsafeNarrowing if the read value is larger than 63 bits. * * @see #read32u() */ diff --git a/core/src/com/riiablo/io/SafeUnsigned.java b/core/src/com/riiablo/io/UnsafeNarrowing.java similarity index 61% rename from core/src/com/riiablo/io/SafeUnsigned.java rename to core/src/com/riiablo/io/UnsafeNarrowing.java index 9333003a..0d5dec86 100644 --- a/core/src/com/riiablo/io/SafeUnsigned.java +++ b/core/src/com/riiablo/io/UnsafeNarrowing.java @@ -1,10 +1,10 @@ package com.riiablo.io; -public class SafeUnsigned extends RuntimeException { +public class UnsafeNarrowing extends RuntimeException { public final long value; - SafeUnsigned(long value) { - super("value(" + value + ") is not unsigned!"); + UnsafeNarrowing(long value) { + super("value(" + value + ") cannot be safely narrowed!"); this.value = value; }