static int p_ulongPutVar(/*P*/ byte[] page, int index, long v) { return encodeUnsignedVarLong(page, index, v); }
static int p_ulongPutVar(/*P*/ byte[] page, int index, long v) { return encodeUnsignedVarLong(page, index, v); }
static int p_ulongPutVar(/*P*/ byte[] page, int index, long v) { return encodeUnsignedVarLong(page, index, v); }
/** * @return new offset */ public static int encodeSignedVarLong(byte[] b, int offset, long v) { if (v < 0) { // Complement negative value to turn all the ones to zeros, which // can be compacted. Shift and put sign bit at LSB. v = ((~v) << 1) | 1; } else { // Shift and put sign bit at LSB. v <<= 1; } return encodeUnsignedVarLong(b, offset, v); }
/** * Caller must hold db commit lock. */ void pushUnalloc(long indexId, byte[] key, long pos, long length) throws IOException { setActiveIndexIdAndKey(indexId, key); byte[] payload = new byte[9 + 9]; int off = encodeUnsignedVarLong(payload, 0, length); off = encodeUnsignedVarLong(payload, off, pos); doPush(OP_UNALLOC, payload, 0, off); }
private void redoWriteUnsignedVarLong(long v) throws IOException { byte[] buffer = mRedoBuffer; int pos = mRedoPos; if (pos > buffer.length - 9) { redoFlush(false); pos = 0; } mRedoPos = Utils.encodeUnsignedVarLong(buffer, pos, v); }
/** * @return new offset */ public static int encodeSignedVarLong(byte[] b, int offset, long v) { return encodeUnsignedVarLong(b, offset, convertSignedVarLong(v)); }
/** * @return new offset */ public static int encodeSignedVarLong(byte[] b, int offset, long v) { return encodeUnsignedVarLong(b, offset, convertSignedVarLong(v)); }
private void redoWriteUnsignedVarLong(long v) throws IOException { byte[] buffer = mRedoBuffer; int pos = mRedoPos; if (pos > buffer.length - 9) { redoFlush(false); pos = 0; } mRedoPos = Utils.encodeUnsignedVarLong(buffer, pos, v); }
/** * Caller must hold db commit lock. */ void pushUnalloc(long indexId, byte[] key, long pos, long length) throws IOException { setActiveIndexIdAndKey(indexId, key); byte[] payload = new byte[9 + 9]; int off = encodeUnsignedVarLong(payload, 0, length); off = encodeUnsignedVarLong(payload, off, pos); doPush(OP_UNALLOC, payload, 0, off); }
/** * Caller must hold db commit lock. */ void pushUnwrite(long indexId, byte[] key, long pos, byte[] b, int off, int len) throws IOException { setActiveIndexIdAndKey(indexId, key); int pLen = calcUnsignedVarLongLength(pos); int varIntLen = calcUnsignedVarIntLength(pLen + len); doPush(OP_UNWRITE, b, off, len, varIntLen, pLen); // Now encode the pos in the reserved region before the payload. _Node node = mNode; int posOff = 1 + varIntLen; if (node != null) { p_ulongPutVar(node.mPage, mNodeTopPos + posOff, pos); } else { encodeUnsignedVarLong(mBuffer, mBufferPos + posOff, pos); } }
/** * Caller must hold db commit lock. */ void pushUnwrite(long indexId, byte[] key, long pos, byte[] b, int off, int len) throws IOException { setActiveIndexIdAndKey(indexId, key); int pLen = calcUnsignedVarLongLength(pos); int varIntLen = calcUnsignedVarIntLength(pLen + len); doPush(OP_UNWRITE, b, off, len, varIntLen, pLen); // Now encode the pos in the reserved region before the payload. Node node = mNode; int posOff = 1 + varIntLen; if (node != null) { p_ulongPutVar(node.mPage, mNodeTopPos + posOff, pos); } else { encodeUnsignedVarLong(mBuffer, mBufferPos + posOff, pos); } }
int varLen = calcUnsignedVarLongLength(delta); offset = (1 + 9) - varLen; encodeUnsignedVarLong(buffer, offset, delta); buffer[--offset] = buffer[0]; length -= offset;
int varLen = calcUnsignedVarLongLength(delta); offset = (1 + 9) - varLen; encodeUnsignedVarLong(buffer, offset, delta); buffer[--offset] = buffer[0]; length -= offset;
int varLen = calcUnsignedVarLongLength(delta); offset = (1 + 9) - varLen; encodeUnsignedVarLong(buffer, offset, delta); buffer[--offset] = buffer[0]; length -= offset;
int varLen = calcUnsignedVarLongLength(delta); offset = (1 + 9) - varLen; encodeUnsignedVarLong(buffer, offset, delta); buffer[--offset] = buffer[0]; length -= offset;
int off = encodeUnsignedVarLong(payload, 0, length); doPush(OP_UNEXTEND, payload, 0, off);
int off = encodeUnsignedVarLong(payload, 0, length); doPush(OP_UNEXTEND, payload, 0, off);