// Path: ohc-core/src/main/java/org/caffinitas/ohc/util/ByteBufferCompat.java
// public static void byteBufferClear(ByteBuffer byteBuffer) {
//     byteBufferAccess.clear(byteBuffer);
// }
// 
// Path: ohc-core/src/main/java/org/caffinitas/ohc/util/ByteBufferCompat.java
// public static void byteBufferFlip(ByteBuffer byteBuffer) {
//     byteBufferAccess.flip(byteBuffer);
// }


import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import sun.misc.Unsafe;
import sun.nio.ch.DirectBuffer;
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Random;
import static org.caffinitas.ohc.util.ByteBufferCompat.byteBufferClear;
import static org.caffinitas.ohc.util.ByteBufferCompat.byteBufferFlip;
import static org.testng.Assert.*;
        try
        {
            for (byte b = 0; b < 13; b++)
                for (int offset = 0; offset < 10; offset += 13)
                {
                    Uns.setMemory(adr, offset, 7777, b);

                    for (int off = 0; off < 7777; off++)
                        assertEquals(unsafe.getByte(adr + offset), b);
                }
        }
        finally
        {
            Uns.free(adr);
        }
    }

    @Test
    public void testGetLongFromByteArray() throws Exception
    {
        byte[] arr = TestUtils.randomBytes(32);
        ByteOrder order = directBuffer.order();
        directBuffer.order(ByteOrder.nativeOrder());
        try
        {
            for (int i = 0; i < 14; i++)
            {
                long u = Uns.getLongFromByteArray(arr, i);
                byteBufferClear(directBuffer);
                directBuffer.put(arr);
// Path: ohc-core/src/main/java/org/caffinitas/ohc/util/ByteBufferCompat.java
// public static void byteBufferClear(ByteBuffer byteBuffer) {
//     byteBufferAccess.clear(byteBuffer);
// }
// 
// Path: ohc-core/src/main/java/org/caffinitas/ohc/util/ByteBufferCompat.java
// public static void byteBufferFlip(ByteBuffer byteBuffer) {
//     byteBufferAccess.flip(byteBuffer);
// }


// Path: ohc-core/src/test/java/org/caffinitas/ohc/linked/UnsTest.java
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import sun.misc.Unsafe;
import sun.nio.ch.DirectBuffer;
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Random;
import static org.caffinitas.ohc.util.ByteBufferCompat.byteBufferClear;
import static org.caffinitas.ohc.util.ByteBufferCompat.byteBufferFlip;
import static org.testng.Assert.*;

        try
        {
            for (byte b = 0; b < 13; b++)
                for (int offset = 0; offset < 10; offset += 13)
                {
                    Uns.setMemory(adr, offset, 7777, b);

                    for (int off = 0; off < 7777; off++)
                        assertEquals(unsafe.getByte(adr + offset), b);
                }
        }
        finally
        {
            Uns.free(adr);
        }
    }

    @Test
    public void testGetLongFromByteArray() throws Exception
    {
        byte[] arr = TestUtils.randomBytes(32);
        ByteOrder order = directBuffer.order();
        directBuffer.order(ByteOrder.nativeOrder());
        try
        {
            for (int i = 0; i < 14; i++)
            {
                long u = Uns.getLongFromByteArray(arr, i);
                byteBufferClear(directBuffer);
                directBuffer.put(arr);
                byteBufferFlip(directBuffer);