New posts

This commit is contained in:
2026-11-06 21:43:48 +05:30
parent ecceaa8b32
commit f7b6c1efca
33 changed files with 1258 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.nio.ByteOrder;
/** AFTER: the same access through a byte-array-view VarHandle (JDK 9). Bounds-checked; native byte order to match Unsafe. */
public final class ViewBytes {
private ViewBytes() {}
private static final VarHandle VIEW = MethodHandles.byteArrayViewVarHandle(long[].class, ByteOrder.nativeOrder());
public static long get(byte[] a, int off) { return (long) VIEW.get(a, off); }
public static void put(byte[] a, int off, long v) { VIEW.set(a, off, v); }
}