final int firstPos = inPos; // so that we won't have back references across block boundary int seen = _getInt(in, inPos) >> 16; int off = hash(seen); int ref = hashTable[off]; hashTable[off] = inPos; || ((seen << 8) != (_getInt(in, ref-1) << 8))) { ++inPos; ++literals; if (literals == LZFChunk.MAX_LITERAL) { outPos = _copyFullLiterals(in, inPos, out, outPos); literals = 0; outPos = _copyPartialLiterals(in, inPos, out, outPos, literals); literals = 0; int len = _findMatchLength(in, ref+3, inPos+3, ref+maxLen); seen = _getInt(in, inPos); hashTable[hash(seen >> 8)] = inPos; ++inPos; hashTable[hash(seen)] = inPos; ++inPos; return _handleTail(in, inPos, inEnd+4, out, outPos, literals);
private final static int _findMatchLength(final byte[] in, int ptr1, int ptr2, final int maxPtr1) { // Expect at least 8 bytes to check for fast case; offline others if ((ptr1 + 8) >= maxPtr1) { // rare case, offline return _findTailMatchLength(in, ptr1, ptr2, maxPtr1); } // short matches common, so start with specialized comparison // NOTE: we know that we have 4 bytes of slack before end, so this is safe: int i1 = unsafe.getInt(in, BYTE_ARRAY_OFFSET + ptr1); int i2 = unsafe.getInt(in, BYTE_ARRAY_OFFSET + ptr2); if (i1 != i2) { return 1 + _leadingBytes(i1, i2); } ptr1 += 4; ptr2 += 4; i1 = unsafe.getInt(in, BYTE_ARRAY_OFFSET + ptr1); i2 = unsafe.getInt(in, BYTE_ARRAY_OFFSET + ptr2); if (i1 != i2) { return 5 + _leadingBytes(i1, i2); } return _findLongMatchLength(in, ptr1+4, ptr2+4, maxPtr1); }
public static UnsafeChunkEncoder createNonAllocatingEncoder(int totalLength, BufferRecycler bufferRecycler) { if (LITTLE_ENDIAN) { return new UnsafeChunkEncoderLE(totalLength, bufferRecycler, false); } return new UnsafeChunkEncoderBE(totalLength, bufferRecycler, false); } }
private final static int _findLongMatchLength(final byte[] in, int ptr1, int ptr2, final int maxPtr1) { final int base = ptr1 - 9; // and then just loop with longs if we get that far final int longEnd = maxPtr1-8; while (ptr1 <= longEnd) { long l1 = unsafe.getLong(in, BYTE_ARRAY_OFFSET + ptr1); long l2 = unsafe.getLong(in, BYTE_ARRAY_OFFSET + ptr2); if (l1 != l2) { return ptr1 - base + _leadingBytes(l1, l2); } ptr1 += 8; ptr2 += 8; } // or, if running out of runway, handle last bytes with loop-de-loop... while (ptr1 < maxPtr1 && in[ptr1] == in[ptr2]) { ++ptr1; ++ptr2; } return ptr1 - base; // i.e. }
public static UnsafeChunkEncoder createEncoder(int totalLength) { if (LITTLE_ENDIAN) { return new UnsafeChunkEncoderLE(totalLength); } return new UnsafeChunkEncoderBE(totalLength); }
private final static int _findLongMatchLength(final byte[] in, int ptr1, int ptr2, final int maxPtr1) { final int base = ptr1 - 9; // and then just loop with longs if we get that far final int longEnd = maxPtr1-8; while (ptr1 <= longEnd) { long l1 = unsafe.getLong(in, BYTE_ARRAY_OFFSET + ptr1); long l2 = unsafe.getLong(in, BYTE_ARRAY_OFFSET + ptr2); if (l1 != l2) { return ptr1 - base + _leadingBytes(l1, l2); } ptr1 += 8; ptr2 += 8; } // or, if running out of runway, handle last bytes with loop-de-loop... while (ptr1 < maxPtr1 && in[ptr1] == in[ptr2]) { ++ptr1; ++ptr2; } return ptr1 - base; // i.e. }
final int firstPos = inPos; // so that we won't have back references across block boundary int seen = _getInt(in, inPos) >> 16; int off = hash(seen); int ref = hashTable[off]; hashTable[off] = inPos; || ((seen << 8) != (_getInt(in, ref-1) << 8))) { ++inPos; ++literals; if (literals == LZFChunk.MAX_LITERAL) { outPos = _copyFullLiterals(in, inPos, out, outPos); literals = 0; outPos = _copyPartialLiterals(in, inPos, out, outPos, literals); literals = 0; int len = _findMatchLength(in, ref+3, inPos+3, ref+maxLen); seen = _getInt(in, inPos); hashTable[hash(seen >> 8)] = inPos; ++inPos; hashTable[hash(seen)] = inPos; ++inPos; return _handleTail(in, inPos, inEnd+4, out, outPos, literals);
private final static int _findMatchLength(final byte[] in, int ptr1, int ptr2, final int maxPtr1) { // Expect at least 8 bytes to check for fast case; offline others if ((ptr1 + 8) >= maxPtr1) { // rare case, offline return _findTailMatchLength(in, ptr1, ptr2, maxPtr1); } // short matches common, so start with specialized comparison // NOTE: we know that we have 4 bytes of slack before end, so this is safe: int i1 = unsafe.getInt(in, BYTE_ARRAY_OFFSET + ptr1); int i2 = unsafe.getInt(in, BYTE_ARRAY_OFFSET + ptr2); if (i1 != i2) { return 1 + _leadingBytes(i1, i2); } ptr1 += 4; ptr2 += 4; i1 = unsafe.getInt(in, BYTE_ARRAY_OFFSET + ptr1); i2 = unsafe.getInt(in, BYTE_ARRAY_OFFSET + ptr2); if (i1 != i2) { return 5 + _leadingBytes(i1, i2); } return _findLongMatchLength(in, ptr1+4, ptr2+4, maxPtr1); }
public static UnsafeChunkEncoder createEncoder(int totalLength) { if (LITTLE_ENDIAN) { return new UnsafeChunkEncoderLE(totalLength); } return new UnsafeChunkEncoderBE(totalLength); }
final int firstPos = inPos; // so that we won't have back references across block boundary int seen = _getInt(in, inPos) >> 16; int off = hash(seen); int ref = hashTable[off]; hashTable[off] = inPos; || ((seen << 8) != (_getInt(in, ref-1) << 8))) { ++inPos; ++literals; if (literals == LZFChunk.MAX_LITERAL) { outPos = _copyFullLiterals(in, inPos, out, outPos); literals = 0; outPos = _copyPartialLiterals(in, inPos, out, outPos, literals); literals = 0; int len = _findMatchLength(in, ref+3, inPos+3, ref+maxLen); seen = _getInt(in, inPos); hashTable[hash(seen >> 8)] = inPos; ++inPos; hashTable[hash(seen)] = inPos; ++inPos; return _handleTail(in, inPos, inEnd+4, out, outPos, literals);
private final static int _findMatchLength(final byte[] in, int ptr1, int ptr2, final int maxPtr1) { // Expect at least 8 bytes to check for fast case; offline others if ((ptr1 + 8) >= maxPtr1) { // rare case, offline return _findTailMatchLength(in, ptr1, ptr2, maxPtr1); } // short matches common, so start with specialized comparison // NOTE: we know that we have 4 bytes of slack before end, so this is safe: int i1 = unsafe.getInt(in, BYTE_ARRAY_OFFSET + ptr1); int i2 = unsafe.getInt(in, BYTE_ARRAY_OFFSET + ptr2); if (i1 != i2) { return 1 + _leadingBytes(i1, i2); } ptr1 += 4; ptr2 += 4; i1 = unsafe.getInt(in, BYTE_ARRAY_OFFSET + ptr1); i2 = unsafe.getInt(in, BYTE_ARRAY_OFFSET + ptr2); if (i1 != i2) { return 5 + _leadingBytes(i1, i2); } return _findLongMatchLength(in, ptr1+4, ptr2+4, maxPtr1); }
public static UnsafeChunkEncoder createNonAllocatingEncoder(int totalLength) { if (LITTLE_ENDIAN) { return new UnsafeChunkEncoderLE(totalLength, false); } return new UnsafeChunkEncoderBE(totalLength, false); }
public static UnsafeChunkEncoder createEncoder(int totalLength, BufferRecycler bufferRecycler) { if (LITTLE_ENDIAN) { return new UnsafeChunkEncoderLE(totalLength, bufferRecycler); } return new UnsafeChunkEncoderBE(totalLength, bufferRecycler); }
public static UnsafeChunkEncoder createNonAllocatingEncoder(int totalLength, BufferRecycler bufferRecycler) { if (LITTLE_ENDIAN) { return new UnsafeChunkEncoderLE(totalLength, bufferRecycler, false); } return new UnsafeChunkEncoderBE(totalLength, bufferRecycler, false); } }
public static UnsafeChunkEncoder createNonAllocatingEncoder(int totalLength) { if (LITTLE_ENDIAN) { return new UnsafeChunkEncoderLE(totalLength, false); } return new UnsafeChunkEncoderBE(totalLength, false); }
public static UnsafeChunkEncoder createEncoder(int totalLength, BufferRecycler bufferRecycler) { if (LITTLE_ENDIAN) { return new UnsafeChunkEncoderLE(totalLength, bufferRecycler); } return new UnsafeChunkEncoderBE(totalLength, bufferRecycler); }
public static UnsafeChunkEncoder createEncoder(int totalLength) { if (LITTLE_ENDIAN) { return new UnsafeChunkEncoderLE(totalLength); } return new UnsafeChunkEncoderBE(totalLength); }
public static UnsafeChunkEncoder createNonAllocatingEncoder(int totalLength) { if (LITTLE_ENDIAN) { return new UnsafeChunkEncoderLE(totalLength, false); } return new UnsafeChunkEncoderBE(totalLength, false); }
public static UnsafeChunkEncoder createEncoder(int totalLength, BufferRecycler bufferRecycler) { if (LITTLE_ENDIAN) { return new UnsafeChunkEncoderLE(totalLength, bufferRecycler); } return new UnsafeChunkEncoderBE(totalLength, bufferRecycler); }
public static UnsafeChunkEncoder createNonAllocatingEncoder(int totalLength, BufferRecycler bufferRecycler) { if (LITTLE_ENDIAN) { return new UnsafeChunkEncoderLE(totalLength, bufferRecycler, false); } return new UnsafeChunkEncoderBE(totalLength, bufferRecycler, false); } }