what-the-bank/sources/o/C1609aJC.java

586 lines
18 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import com.google.android.libraries.places.api.model.PlaceTypes;
import com.google.common.primitives.UnsignedBytes;
import java.lang.reflect.Field;
import java.nio.Buffer;
import java.nio.ByteOrder;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import java.util.logging.Level;
import java.util.logging.Logger;
import sun.misc.Unsafe;
/* renamed from: o.aJC, reason: case insensitive filesystem */
/* loaded from: classes2.dex */
public final class C1609aJC {
private static final boolean a;
private static final boolean b;
private static final boolean c;
static final long d;
static final boolean e;
private static final boolean f;
private static final HBt g;
private static final Class<?> h;
private static final Unsafe i;
static /* synthetic */ Field d() {
return e();
}
static {
Unsafe b2 = b();
i = b2;
h = C3269auN.c();
boolean c2 = c((Class<?>) Long.TYPE);
f = c2;
boolean c3 = c((Class<?>) Integer.TYPE);
b = c3;
HBt hBt = null;
if (b2 != null) {
if (!C3269auN.e()) {
hBt = new RVV(b2);
} else if (c2) {
hBt = new Sts(b2);
} else if (c3) {
hBt = new IeS(b2);
}
}
g = hBt;
a = hBt == null ? false : hBt.a();
boolean d2 = hBt == null ? false : hBt.d();
c = d2;
d = d2 ? hBt.a.arrayBaseOffset(byte[].class) : -1;
if (d2) {
hBt.a.arrayBaseOffset(boolean[].class);
}
if (d2) {
hBt.a.arrayIndexScale(boolean[].class);
}
if (d2) {
hBt.a.arrayBaseOffset(int[].class);
}
if (d2) {
hBt.a.arrayIndexScale(int[].class);
}
if (d2) {
hBt.a.arrayBaseOffset(long[].class);
}
if (d2) {
hBt.a.arrayIndexScale(long[].class);
}
if (d2) {
hBt.a.arrayBaseOffset(float[].class);
}
if (d2) {
hBt.a.arrayIndexScale(float[].class);
}
if (d2) {
hBt.a.arrayBaseOffset(double[].class);
}
if (d2) {
hBt.a.arrayIndexScale(double[].class);
}
if (d2) {
hBt.a.arrayBaseOffset(Object[].class);
}
if (d2) {
hBt.a.arrayIndexScale(Object[].class);
}
Field e2 = e();
if (e2 != null && hBt != null) {
hBt.a.objectFieldOffset(e2);
}
e = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN;
}
private C1609aJC() {
}
/* JADX INFO: Access modifiers changed from: package-private */
public static <T> T d(Class<T> cls) {
try {
return (T) i.allocateInstance(cls);
} catch (InstantiationException e2) {
throw new IllegalStateException(e2);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public static int f(Object obj, long j) {
return g.a.getInt(obj, j);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static void d(Object obj, long j, int i2) {
g.a.putInt(obj, j, i2);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static long j(Object obj, long j) {
return g.a.getLong(obj, j);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static void e(Object obj, long j, long j2) {
g.a.putLong(obj, j, j2);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static boolean b(Object obj, long j) {
return g.d(obj, j);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static void b(Object obj, long j, boolean z) {
g.a(obj, j, z);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static float i(Object obj, long j) {
return g.e(obj, j);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static void b(Object obj, long j, float f2) {
g.a(obj, j, f2);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static double h(Object obj, long j) {
return g.b(obj, j);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static void b(Object obj, long j, double d2) {
g.c(obj, j, d2);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static Object g(Object obj, long j) {
return g.a.getObject(obj, j);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static void b(Object obj, long j, Object obj2) {
g.a.putObject(obj, j, obj2);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static byte e(byte[] bArr, long j) {
return g.a(bArr, d + j);
}
public static void c(byte[] bArr, long j, byte b2) {
g.a((Object) bArr, d + j, b2);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static Unsafe b() {
try {
return (Unsafe) AccessController.doPrivileged(new PrivilegedExceptionAction<Unsafe>() { // from class: o.aJC.5
@Override // java.security.PrivilegedExceptionAction
public final /* synthetic */ Unsafe run() throws Exception {
for (Field field : Unsafe.class.getDeclaredFields()) {
field.setAccessible(true);
Object obj = field.get(null);
if (Unsafe.class.isInstance(obj)) {
return (Unsafe) Unsafe.class.cast(obj);
}
}
return null;
}
});
} catch (Throwable unused) {
return null;
}
}
private static boolean c(Class<?> cls) {
if (!C3269auN.e()) {
return false;
}
try {
Class<?> cls2 = h;
cls2.getMethod("peekLong", cls, Boolean.TYPE);
cls2.getMethod("pokeLong", cls, Long.TYPE, Boolean.TYPE);
cls2.getMethod("pokeInt", cls, Integer.TYPE, Boolean.TYPE);
cls2.getMethod("peekInt", cls, Boolean.TYPE);
cls2.getMethod("pokeByte", cls, Byte.TYPE);
cls2.getMethod("peekByte", cls);
cls2.getMethod("pokeByteArray", cls, byte[].class, Integer.TYPE, Integer.TYPE);
cls2.getMethod("peekByteArray", cls, byte[].class, Integer.TYPE, Integer.TYPE);
return true;
} catch (Throwable unused) {
return false;
}
}
private static Field e() {
Field e2;
if (C3269auN.e() && (e2 = e((Class<?>) Buffer.class, "effectiveDirectAddress")) != null) {
return e2;
}
Field e3 = e((Class<?>) Buffer.class, PlaceTypes.ADDRESS);
if (e3 == null || e3.getType() != Long.TYPE) {
return null;
}
return e3;
}
private static Field e(Class<?> cls, String str) {
try {
return cls.getDeclaredField(str);
} catch (Throwable unused) {
return null;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: o.aJC$HBt */
/* loaded from: classes2.dex */
public static abstract class HBt {
Unsafe a;
public abstract byte a(Object obj, long j);
public abstract void a(Object obj, long j, byte b);
public abstract void a(Object obj, long j, float f);
public abstract void a(Object obj, long j, boolean z);
public abstract double b(Object obj, long j);
public abstract void c(Object obj, long j, double d);
public abstract boolean d(Object obj, long j);
public abstract float e(Object obj, long j);
HBt(Unsafe unsafe) {
this.a = unsafe;
}
public boolean d() {
Unsafe unsafe = this.a;
if (unsafe == null) {
return false;
}
try {
Class<?> cls = unsafe.getClass();
cls.getMethod("objectFieldOffset", Field.class);
cls.getMethod("arrayBaseOffset", Class.class);
cls.getMethod("arrayIndexScale", Class.class);
cls.getMethod("getInt", Object.class, Long.TYPE);
cls.getMethod("putInt", Object.class, Long.TYPE, Integer.TYPE);
cls.getMethod("getLong", Object.class, Long.TYPE);
cls.getMethod("putLong", Object.class, Long.TYPE, Long.TYPE);
cls.getMethod("getObject", Object.class, Long.TYPE);
cls.getMethod("putObject", Object.class, Long.TYPE, Object.class);
return true;
} catch (Throwable th) {
C1609aJC.c(th);
return false;
}
}
public boolean a() {
Unsafe unsafe = this.a;
if (unsafe == null) {
return false;
}
try {
Class<?> cls = unsafe.getClass();
cls.getMethod("objectFieldOffset", Field.class);
cls.getMethod("getLong", Object.class, Long.TYPE);
return C1609aJC.d() != null;
} catch (Throwable th) {
C1609aJC.c(th);
return false;
}
}
}
/* renamed from: o.aJC$RVV */
/* loaded from: classes2.dex */
static final class RVV extends HBt {
RVV(Unsafe unsafe) {
super(unsafe);
}
@Override // o.C1609aJC.HBt
public final boolean d() {
if (!super.d()) {
return false;
}
try {
Class<?> cls = this.a.getClass();
cls.getMethod("getByte", Object.class, Long.TYPE);
cls.getMethod("putByte", Object.class, Long.TYPE, Byte.TYPE);
cls.getMethod("getBoolean", Object.class, Long.TYPE);
cls.getMethod("putBoolean", Object.class, Long.TYPE, Boolean.TYPE);
cls.getMethod("getFloat", Object.class, Long.TYPE);
cls.getMethod("putFloat", Object.class, Long.TYPE, Float.TYPE);
cls.getMethod("getDouble", Object.class, Long.TYPE);
cls.getMethod("putDouble", Object.class, Long.TYPE, Double.TYPE);
return true;
} catch (Throwable th) {
C1609aJC.c(th);
return false;
}
}
@Override // o.C1609aJC.HBt
public final byte a(Object obj, long j) {
return this.a.getByte(obj, j);
}
@Override // o.C1609aJC.HBt
public final void a(Object obj, long j, byte b) {
this.a.putByte(obj, j, b);
}
@Override // o.C1609aJC.HBt
public final boolean d(Object obj, long j) {
return this.a.getBoolean(obj, j);
}
@Override // o.C1609aJC.HBt
public final void a(Object obj, long j, boolean z) {
this.a.putBoolean(obj, j, z);
}
@Override // o.C1609aJC.HBt
public final float e(Object obj, long j) {
return this.a.getFloat(obj, j);
}
@Override // o.C1609aJC.HBt
public final void a(Object obj, long j, float f) {
this.a.putFloat(obj, j, f);
}
@Override // o.C1609aJC.HBt
public final double b(Object obj, long j) {
return this.a.getDouble(obj, j);
}
@Override // o.C1609aJC.HBt
public final void c(Object obj, long j, double d) {
this.a.putDouble(obj, j, d);
}
@Override // o.C1609aJC.HBt
public final boolean a() {
if (!super.a()) {
return false;
}
try {
Class<?> cls = this.a.getClass();
cls.getMethod("getByte", Long.TYPE);
cls.getMethod("putByte", Long.TYPE, Byte.TYPE);
cls.getMethod("getInt", Long.TYPE);
cls.getMethod("putInt", Long.TYPE, Integer.TYPE);
cls.getMethod("getLong", Long.TYPE);
cls.getMethod("putLong", Long.TYPE, Long.TYPE);
cls.getMethod("copyMemory", Long.TYPE, Long.TYPE, Long.TYPE);
cls.getMethod("copyMemory", Object.class, Long.TYPE, Object.class, Long.TYPE, Long.TYPE);
return true;
} catch (Throwable th) {
C1609aJC.c(th);
return false;
}
}
}
/* renamed from: o.aJC$Sts */
/* loaded from: classes2.dex */
static final class Sts extends HBt {
@Override // o.C1609aJC.HBt
public final boolean a() {
return false;
}
Sts(Unsafe unsafe) {
super(unsafe);
}
@Override // o.C1609aJC.HBt
public final byte a(Object obj, long j) {
if (C1609aJC.e) {
return C1609aJC.d(obj, j);
}
return C1609aJC.e(obj, j);
}
@Override // o.C1609aJC.HBt
public final void a(Object obj, long j, byte b) {
if (C1609aJC.e) {
C1609aJC.d(obj, j, b);
} else {
C1609aJC.a(obj, j, b);
}
}
@Override // o.C1609aJC.HBt
public final boolean d(Object obj, long j) {
if (C1609aJC.e) {
return C1609aJC.a(obj, j);
}
return C1609aJC.c(obj, j);
}
@Override // o.C1609aJC.HBt
public final void a(Object obj, long j, boolean z) {
if (C1609aJC.e) {
C1609aJC.d(obj, j, z);
} else {
C1609aJC.c(obj, j, z);
}
}
@Override // o.C1609aJC.HBt
public final float e(Object obj, long j) {
return Float.intBitsToFloat(this.a.getInt(obj, j));
}
@Override // o.C1609aJC.HBt
public final void a(Object obj, long j, float f) {
this.a.putInt(obj, j, Float.floatToIntBits(f));
}
@Override // o.C1609aJC.HBt
public final double b(Object obj, long j) {
return Double.longBitsToDouble(this.a.getLong(obj, j));
}
@Override // o.C1609aJC.HBt
public final void c(Object obj, long j, double d) {
this.a.putLong(obj, j, Double.doubleToLongBits(d));
}
}
/* renamed from: o.aJC$IeS */
/* loaded from: classes2.dex */
static final class IeS extends HBt {
@Override // o.C1609aJC.HBt
public final boolean a() {
return false;
}
IeS(Unsafe unsafe) {
super(unsafe);
}
@Override // o.C1609aJC.HBt
public final byte a(Object obj, long j) {
if (C1609aJC.e) {
return C1609aJC.d(obj, j);
}
return C1609aJC.e(obj, j);
}
@Override // o.C1609aJC.HBt
public final void a(Object obj, long j, byte b) {
if (C1609aJC.e) {
C1609aJC.d(obj, j, b);
} else {
C1609aJC.a(obj, j, b);
}
}
@Override // o.C1609aJC.HBt
public final boolean d(Object obj, long j) {
if (C1609aJC.e) {
return C1609aJC.a(obj, j);
}
return C1609aJC.c(obj, j);
}
@Override // o.C1609aJC.HBt
public final void a(Object obj, long j, boolean z) {
if (C1609aJC.e) {
C1609aJC.d(obj, j, z);
} else {
C1609aJC.c(obj, j, z);
}
}
@Override // o.C1609aJC.HBt
public final float e(Object obj, long j) {
return Float.intBitsToFloat(this.a.getInt(obj, j));
}
@Override // o.C1609aJC.HBt
public final void a(Object obj, long j, float f) {
this.a.putInt(obj, j, Float.floatToIntBits(f));
}
@Override // o.C1609aJC.HBt
public final double b(Object obj, long j) {
return Double.longBitsToDouble(this.a.getLong(obj, j));
}
@Override // o.C1609aJC.HBt
public final void c(Object obj, long j, double d) {
this.a.putLong(obj, j, Double.doubleToLongBits(d));
}
}
/* JADX INFO: Access modifiers changed from: private */
public static void d(Object obj, long j, byte b2) {
long j2 = (-4) & j;
HBt hBt = g;
int i2 = hBt.a.getInt(obj, j2);
int i3 = ((~((int) j)) & 3) << 3;
hBt.a.putInt(obj, j2, ((~(255 << i3)) & i2) | ((b2 & UnsignedBytes.MAX_VALUE) << i3));
}
/* JADX INFO: Access modifiers changed from: private */
public static void a(Object obj, long j, byte b2) {
long j2 = (-4) & j;
HBt hBt = g;
int i2 = hBt.a.getInt(obj, j2);
int i3 = (((int) j) & 3) << 3;
hBt.a.putInt(obj, j2, ((~(255 << i3)) & i2) | ((b2 & UnsignedBytes.MAX_VALUE) << i3));
}
static /* synthetic */ void c(Throwable th) {
Logger.getLogger(C1609aJC.class.getName()).log(Level.WARNING, "platform method missing - proto runtime falling back to safer methods: ".concat(String.valueOf(th)));
}
static /* synthetic */ byte d(Object obj, long j) {
return (byte) (g.a.getInt(obj, (-4) & j) >>> ((int) (((~j) & 3) << 3)));
}
static /* synthetic */ byte e(Object obj, long j) {
return (byte) (g.a.getInt(obj, (-4) & j) >>> ((int) ((j & 3) << 3)));
}
static /* synthetic */ boolean a(Object obj, long j) {
return ((byte) (g.a.getInt(obj, (-4) & j) >>> ((int) (((~j) & 3) << 3)))) != 0;
}
static /* synthetic */ boolean c(Object obj, long j) {
return ((byte) (g.a.getInt(obj, (-4) & j) >>> ((int) ((j & 3) << 3)))) != 0;
}
static /* synthetic */ void d(Object obj, long j, boolean z) {
d(obj, j, z ? (byte) 1 : (byte) 0);
}
static /* synthetic */ void c(Object obj, long j, boolean z) {
a(obj, j, z ? (byte) 1 : (byte) 0);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static boolean c() {
return a;
}
public static boolean a() {
return c;
}
}