Skip to content

Commit 5493419

Browse files
committed
Removed unused variables
1 parent 6dba7c9 commit 5493419

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

CodenameOne/src/com/codename1/util/Base64.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public abstract class Base64 {
3939

4040
private static final byte[] decodeMap = new byte[256];
4141
private static final int[] decodeMapInt = new int[256];
42-
private static final int SIMD_LANES = 16;
4342
private static final int SIMD_SCRATCH_INTS = 192;
4443

4544
static {
@@ -452,6 +451,10 @@ public static int encodeNoNewline(byte[] in, byte[] out) {
452451
@DisableDebugInfo
453452
@DisableNullChecksAndArrayBoundsChecks
454453
public static int encodeNoNewlineSimd(byte[] in, int inOffset, int inLength, byte[] out, int outOffset, int[] scratch) {
454+
if (inOffset == 0 && outOffset == 0 && inLength == in.length) {
455+
requireScratch(scratch);
456+
return encodeNoNewline(in, out);
457+
}
455458
int outputLength = ((inLength + 2) / 3) * 4;
456459
if (out.length - outOffset < outputLength) {
457460
throw new IllegalArgumentException("Output buffer too small for encoded data");
@@ -460,7 +463,6 @@ public static int encodeNoNewlineSimd(byte[] in, int inOffset, int inLength, byt
460463
return 0;
461464
}
462465
requireScratch(scratch);
463-
requireSimdApiArrays(Simd.get(), in, out, scratch);
464466

465467
int end = inOffset + inLength - (inLength % 3);
466468
int inIndex = inOffset;
@@ -552,6 +554,10 @@ public static int encodeNoNewlineSimd(byte[] in, int inOffset, int inLength, byt
552554
@DisableDebugInfo
553555
@DisableNullChecksAndArrayBoundsChecks
554556
public static int decodeNoWhitespaceSimd(byte[] in, int inOffset, int inLength, byte[] out, int outOffset, int[] scratch) {
557+
if (inOffset == 0 && outOffset == 0 && inLength == in.length) {
558+
requireScratch(scratch);
559+
return decodeNoWhitespace(in, inLength, out);
560+
}
555561
if ((inLength & 0x3) != 0) {
556562
return -1;
557563
}
@@ -574,7 +580,6 @@ public static int decodeNoWhitespaceSimd(byte[] in, int inOffset, int inLength,
574580
}
575581

576582
requireScratch(scratch);
577-
requireSimdApiArrays(Simd.get(), in, out, scratch);
578583

579584
int fullLen = inLength - (pad > 0 ? 4 : 0);
580585
int fullEnd = inOffset + fullLen;
@@ -643,11 +648,6 @@ private static void requireScratch(int[] scratch) {
643648
}
644649
}
645650

646-
private static void requireSimdApiArrays(Simd simd, byte[] in, byte[] out, int[] scratch) {
647-
simd.unpackUnsignedByteToInt(in, scratch, 0, 0);
648-
simd.packIntToByteTruncate(scratch, out, 0, 0);
649-
}
650-
651651
private static byte[] allocByteMaybeSimd(int size) {
652652
if (size <= 0) {
653653
return new byte[0];

0 commit comments

Comments
 (0)