com/hypixel/fastutil/util/SneakyThrow.java
package com.hypixel.fastutil.util;
public class SneakyThrow {
public SneakyThrow() {
}
public static RuntimeException sneakyThrow(Throwable t) {
if (t == null) {
throw new NullPointerException("t");
} else {
return (RuntimeException)sneakyThrow0(t);
}
}
private static <T extends Throwable> T sneakyThrow0(Throwable t) throws T {
throw t;
}
}
com/hypixel/fastutil/util/TLRUtil.java
package com.hypixel.fastutil.util;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.util.concurrent.ThreadLocalRandom;
import sun.misc.Unsafe;
public class TLRUtil {
private static final Unsafe UNSAFE;
private static final long PROBE;
public TLRUtil() {
}
public static void localInit() {
ThreadLocalRandom.current();
}
public static int getProbe() {
return UNSAFE.getInt(Thread.currentThread(), PROBE);
}
public static int advanceProbe(int probe) {
probe ^= probe << 13;
probe ^= probe >>> 17;
probe ^= probe << 5;
UNSAFE.putInt(Thread.currentThread(), PROBE, probe);
return probe;
}
static {
Unsafe instance;
try {
Field field = Unsafe.class.getDeclaredField("theUnsafe");
field.setAccessible(true);
instance = (Unsafe)field.get((Object)null);
} catch (Exception var5) {
try {
Constructor<Unsafe> c = Unsafe.class.getDeclaredConstructor();
c.setAccessible(true);
instance = (Unsafe)c.newInstance();
} catch (Exception e) {
throw SneakyThrow.sneakyThrow(e);
}
}
UNSAFE = instance;
try {
PROBE = UNSAFE.objectFieldOffset(Thread.class.getDeclaredField("threadLocalRandomProbe"));
} catch (NoSuchFieldException t) {
throw SneakyThrow.sneakyThrow(t);
}
}
}