@Test public void testInit() throws Exception { long adr = Uns.allocate(MIN_ALLOC_LEN); boolean ok = false; try { HashEntries.init(0x98765432abcddeafL, 5, 10, adr, 0, 0L); assertEquals(Uns.getLong(adr, Util.ENTRY_OFF_HASH), 0x98765432abcddeafL); assertEquals(Uns.getInt(adr, Util.ENTRY_OFF_KEY_LENGTH), 5L); assertEquals(Uns.getInt(adr, Util.ENTRY_OFF_VALUE_LENGTH), 10L); assertEquals(HashEntries.getHash(adr), 0x98765432abcddeafL); assertEquals(HashEntries.getKeyLen(adr), 5L); assertEquals(HashEntries.getValueLen(adr), 10L); assertTrue(HashEntries.dereference(adr)); ok = true; } finally { if (!ok) Uns.free(adr); } }
static void init(long hash, int keyLen, int valueLen, long hashEntryAdr, int sentinel, long expireAt) { Uns.putLong(hashEntryAdr, Util.ENTRY_OFF_EXPIRE_AT, expireAt); Uns.putLong(hashEntryAdr, Util.ENTRY_OFF_HASH, hash); setNext(hashEntryAdr, 0L); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_KEY_LENGTH, keyLen); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_VALUE_LENGTH, valueLen); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_REFCOUNT, 1); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_GENERATION, Util.GEN_EDEN); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_SENTINEL, sentinel); }
HashEntries { static void init(long hash, int keyLen, int valueLen, long hashEntryAdr, int sentinel, long expireAt) { Uns.putLong(hashEntryAdr, Util.ENTRY_OFF_EXPIRE_AT, expireAt); Uns.putLong(hashEntryAdr, Util.ENTRY_OFF_HASH, hash); setNext(hashEntryAdr, 0L); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_KEY_LENGTH, keyLen); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_VALUE_LENGTH, valueLen); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_REFCOUNT, 1); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_GENERATION, Util.GEN_EDEN); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_SENTINEL, sentinel); } }
HashEntries { static void init(long hash, int keyLen, int valueLen, long hashEntryAdr, int sentinel, long expireAt) { Uns.putLong(hashEntryAdr, Util.ENTRY_OFF_EXPIRE_AT, expireAt); Uns.putLong(hashEntryAdr, Util.ENTRY_OFF_HASH, hash); setNext(hashEntryAdr, 0L); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_KEY_LENGTH, keyLen); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_VALUE_LENGTH, valueLen); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_REFCOUNT, 1); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_GENERATION, Util.GEN_EDEN); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_SENTINEL, sentinel); }  }
HashEntries { static void init(long hash, int keyLen, int valueLen, long hashEntryAdr, int sentinel, long expireAt) { Uns.putLong(hashEntryAdr, Util.ENTRY_OFF_EXPIRE_AT, expireAt); Uns.putLong(hashEntryAdr, Util.ENTRY_OFF_HASH, hash); setNext(hashEntryAdr, 0L); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_KEY_LENGTH, keyLen); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_VALUE_LENGTH, valueLen); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_REFCOUNT, 1); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_GENERATION, Util.GEN_EDEN); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_SENTINEL, sentinel); }   }
HashEntries { static void init(long hash, int keyLen, int valueLen, long hashEntryAdr, int sentinel, long expireAt) { Uns.putLong(hashEntryAdr, Util.ENTRY_OFF_EXPIRE_AT, expireAt); Uns.putLong(hashEntryAdr, Util.ENTRY_OFF_HASH, hash); setNext(hashEntryAdr, 0L); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_KEY_LENGTH, keyLen); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_VALUE_LENGTH, valueLen); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_REFCOUNT, 1); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_GENERATION, Util.GEN_EDEN); Uns.putInt(hashEntryAdr, Util.ENTRY_OFF_SENTINEL, sentinel); }    }