77 lines
2.3 KiB
Java
77 lines
2.3 KiB
Java
package o;
|
|
|
|
import com.google.common.primitives.SignedBytes;
|
|
import java.io.ByteArrayOutputStream;
|
|
import net.sf.scuba.smartcards.ISO7816;
|
|
|
|
/* renamed from: o.ghW, reason: case insensitive filesystem */
|
|
/* loaded from: classes6.dex */
|
|
public final class C15109ghW {
|
|
public static boolean c(int i) {
|
|
int i2 = 3;
|
|
while (i2 >= 0 && ((255 << (i2 << 3)) & i) == 0) {
|
|
i2--;
|
|
}
|
|
int i3 = i2 << 3;
|
|
return (((i & (255 << i3)) >> i3) & 32) == 0;
|
|
}
|
|
|
|
private static int d(int i) {
|
|
int i2 = 3;
|
|
while (i2 >= 0 && ((255 << (i2 << 3)) & i) == 0) {
|
|
i2--;
|
|
}
|
|
int i3 = i2 << 3;
|
|
int i4 = ((i & (255 << i3)) >> i3) & 192;
|
|
if (i4 == 0) {
|
|
return 0;
|
|
}
|
|
if (i4 != 64) {
|
|
return i4 != 128 ? 3 : 2;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
public static byte[] b(int i) {
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
int log = ((int) (Math.log(i) / Math.log(256.0d))) + 1;
|
|
for (int i2 = 0; i2 < log; i2++) {
|
|
int i3 = ((log - i2) - 1) << 3;
|
|
byteArrayOutputStream.write(((255 << i3) & i) >> i3);
|
|
}
|
|
byte[] byteArray = byteArrayOutputStream.toByteArray();
|
|
int d = d(i);
|
|
if (d == 1) {
|
|
byteArray[0] = (byte) (byteArray[0] | SignedBytes.MAX_POWER_OF_TWO);
|
|
} else if (d == 2) {
|
|
byteArray[0] = (byte) (byteArray[0] | 128);
|
|
} else if (d == 3) {
|
|
byteArray[0] = (byte) (byteArray[0] | ISO7816.INS_GET_RESPONSE);
|
|
}
|
|
if (!c(i)) {
|
|
byteArray[0] = (byte) (byteArray[0] | 32);
|
|
}
|
|
return byteArray;
|
|
}
|
|
|
|
public static byte[] a(int i) {
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
if (i < 128) {
|
|
byteArrayOutputStream.write(i);
|
|
} else {
|
|
int i2 = i;
|
|
int i3 = 0;
|
|
while (i2 > 0) {
|
|
i2 /= 256;
|
|
i3++;
|
|
}
|
|
byteArrayOutputStream.write(i3 | 128);
|
|
for (int i4 = 0; i4 < i3; i4++) {
|
|
int i5 = ((i3 - i4) - 1) << 3;
|
|
byteArrayOutputStream.write(((255 << i5) & i) >> i5);
|
|
}
|
|
}
|
|
return byteArrayOutputStream.toByteArray();
|
|
}
|
|
}
|