Skip to content

Commit 9ca7b12

Browse files
committed
Add comment for fast path processing
1 parent 335a8fc commit 9ca7b12

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/main/java/net/eewbot/base32768j/Base32768Decoder.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ public byte[] decode(String src) {
189189
long acc = 0L;
190190
int bitCount = 0;
191191

192+
// ---- Fast Path (2文字): 2文字(=30bit) -> 3バイト + 余り6bit ----
192193
final int fast2Limit = end - 1; // 2文字取れる限界(lastは除外)
193194
while (si < fast2Limit) {
194195
final int v0 = decode[src.charAt(si)];
@@ -254,9 +255,7 @@ public byte[] decode(String src) {
254255
if (bitCount > 0 && (acc & ((1L << bitCount) - 1)) != ((1L << bitCount) - 1)) {
255256
long actual = acc & ((1L << bitCount) - 1);
256257
long expected = (1L << bitCount) - 1;
257-
throw new IllegalBase32768TextException(
258-
"Bad padding at position " + (n - 1) + ": expected " + bitCount + " bits of 1s, got 0b" + Long.toBinaryString(actual)
259-
);
258+
throw new IllegalBase32768TextException("Bad padding at position " + (n - 1) + ": expected " + bitCount + " bits of 1s, got 0b" + Long.toBinaryString(actual));
260259
}
261260

262261
return out;

0 commit comments

Comments
 (0)