public static int bytesInt(byte[] _bytes) { return bytesInt(_bytes, 0); }
public float getFloat(int offset) { try { if (bb != null) { return bb.getFloat(this.offset + offset); } return Float.intBitsToFloat(UIO.bytesInt(bytes, this.offset + offset)); } catch (Exception x) { LOG.error("getLong({}) failed against{} ", offset, this); throw x; } }
public int getInt(int offset) { try { if (bb != null) { return bb.getInt(this.offset + offset); } return UIO.bytesInt(bytes, this.offset + offset); } catch (Exception x) { LOG.error("getInt({}) failed against{} ", offset, this); throw x; } }
public long getUnsignedInt(int offset) { try { if (bb != null) { return bb.getInt(this.offset + offset) & 0xffffffffL; } return UIO.bytesInt(bytes, this.offset + offset) & 0xffffffffL; } catch (Exception x) { LOG.error("getInt({}) failed against{} ", offset, this); throw x; } }
public byte[] bytes(long address) { if (address == -1) { return null; } LABMemorySlabs m = memory; byte[] slab = m.slab(address); int slabAddress = m.slabIndex(address); int length = UIO.bytesInt(slab, slabAddress); if (length > -1) { byte[] copy = new byte[length]; System.arraycopy(slab, slabAddress + 4, copy, 0, length); return copy; } else { throw new IllegalStateException("Address:" + slabAddress + " length=" + length); } }
public int release(long address) { if (address == -1) { return 0; } LABMemorySlabs m = memory; byte[] slab = m.slab(address); int slabAddress = m.slabIndex(address); return UIO.bytesInt(slab, slabAddress); }
public int compareBL(Rawhide rawhide, byte[] leftBytes, int leftOffset, int leftLength, long rightAddress ) { if (rightAddress == -1) { return rawhide.compareBB(leftBytes, leftOffset, leftBytes == null ? -1 : leftLength, null, -1, -1); } else { LABMemorySlabs m = memory; int rightIndex = (int) (rightAddress >>> m.powerSize); rightAddress &= m.powerMask; byte[] rightCopy = m.slabs[rightIndex]; int l2 = UIO.bytesInt(rightCopy, (int) rightAddress); return rawhide.compareBB(leftBytes, leftOffset, leftBytes == null ? -1 : leftLength, rightCopy, (int) rightAddress + 4, l2); } }
public int compareLB(Rawhide rawhide, long leftAddress, byte[] rightBytes, int rightOffset, int rightLength ) { if (leftAddress == -1) { return rawhide.compareBB(null, -1, -1, rightBytes, rightOffset, rightBytes == null ? -1 : rightLength); } else { LABMemorySlabs m = memory; int leftIndex = (int) (leftAddress >>> m.powerSize); leftAddress &= m.powerMask; byte[] leftCopy = m.slabs[leftIndex]; int leftLength = UIO.bytesInt(leftCopy, (int) leftAddress); return rawhide.compareBB(leftCopy, (int) leftAddress + 4, leftLength, rightBytes, rightOffset, rightBytes == null ? -1 : rightLength); } }
public boolean acquireBytes(long address, BolBuffer bolBuffer) { LABMemorySlabs m = memory; byte[] slab = m.slab(address); int slabAddress = m.slabIndex(address); bolBuffer.force(slab, slabAddress + 4, UIO.bytesInt(slab, slabAddress)); return true; }