public T intern(@NotNull BytesStore cs, int length)
throws IllegalArgumentException, IORuntimeException, BufferUnderflowException {
if (length > entries.length)
return getValue(cs, length);
int hash = hash32(cs, length);
int h = hash & mask;
InternerEntry<T> s = entries[h];
if (s != null && s.bytes.length() == length && s.bytes.equalBytes(cs, length))
return s.t;
int h2 = (hash >> shift) & mask;
InternerEntry<T> s2 = entries[h2];
if (s2 != null && s2.bytes.length() == length && s2.bytes.equalBytes(cs, length))
return s2.t;
@NotNull T t = getValue(cs, length);
@NotNull final byte[] bytes = new byte[length];
@NotNull BytesStore bs = BytesStore.wrap(bytes);
cs.read(cs.readPosition(), bytes, 0, length);
entries[s == null || (s2 != null && toggle()) ? h : h2] = new InternerEntry<>(bs, t);
return t;
}