java.lang.Object
org.apache.lucene.backward_codecs.lucene912.ForDeltaUtil

final class ForDeltaUtil extends Object
Inspired from https://fulmicoton.com/posts/bitpacking/ Encodes multiple integers in a long to get SIMD-like speedups. If bitsPerValue <= 4 then we pack 8 ints per long else if bitsPerValue <= 11 we pack 4 ints per long else we pack 2 ints per long
  • Field Details

    • ONE_BLOCK_SIZE_FOURTH

      private static final int ONE_BLOCK_SIZE_FOURTH
      See Also:
    • TWO_BLOCK_SIZE_FOURTHS

      private static final int TWO_BLOCK_SIZE_FOURTHS
      See Also:
    • THREE_BLOCK_SIZE_FOURTHS

      private static final int THREE_BLOCK_SIZE_FOURTHS
      See Also:
    • ONE_BLOCK_SIZE_EIGHT

      private static final int ONE_BLOCK_SIZE_EIGHT
      See Also:
    • TWO_BLOCK_SIZE_EIGHTS

      private static final int TWO_BLOCK_SIZE_EIGHTS
      See Also:
    • THREE_BLOCK_SIZE_EIGHTS

      private static final int THREE_BLOCK_SIZE_EIGHTS
      See Also:
    • FOUR_BLOCK_SIZE_EIGHTS

      private static final int FOUR_BLOCK_SIZE_EIGHTS
      See Also:
    • FIVE_BLOCK_SIZE_EIGHTS

      private static final int FIVE_BLOCK_SIZE_EIGHTS
      See Also:
    • SIX_BLOCK_SIZE_EIGHTS

      private static final int SIX_BLOCK_SIZE_EIGHTS
      See Also:
    • SEVEN_BLOCK_SIZE_EIGHTS

      private static final int SEVEN_BLOCK_SIZE_EIGHTS
      See Also:
    • IDENTITY_PLUS_ONE

      private static final long[] IDENTITY_PLUS_ONE
    • tmp

      private final long[] tmp
  • Constructor Details

    • ForDeltaUtil

      ForDeltaUtil()
  • Method Details

    • prefixSumOfOnes

      private static void prefixSumOfOnes(long[] arr, long base)
    • prefixSum8

      private static void prefixSum8(long[] arr, long base)
    • prefixSum16

      private static void prefixSum16(long[] arr, long base)
    • prefixSum32

      private static void prefixSum32(long[] arr, long base)
    • innerPrefixSum8

      private static void innerPrefixSum8(long[] arr)
    • innerPrefixSum16

      private static void innerPrefixSum16(long[] arr)
    • innerPrefixSum32

      private static void innerPrefixSum32(long[] arr)
    • encodeDeltas

      void encodeDeltas(long[] longs, DataOutput out) throws IOException
      Encode deltas of a strictly monotonically increasing sequence of integers. The provided longs are expected to be deltas between consecutive values.
      Throws:
      IOException
    • decodeAndPrefixSum

      void decodeAndPrefixSum(IndexInput in, long base, long[] longs) throws IOException
      Decode deltas, compute the prefix sum and add base to all decoded longs.
      Throws:
      IOException
    • decodeAndPrefixSum

      void decodeAndPrefixSum(int bitsPerValue, IndexInput in, long base, long[] longs) throws IOException
      Delta-decode 128 integers into longs.
      Throws:
      IOException
    • decode5To16

      private static void decode5To16(IndexInput in, long[] tmp, long[] longs) throws IOException
      Throws:
      IOException
    • decode6To16

      private static void decode6To16(IndexInput in, long[] tmp, long[] longs) throws IOException
      Throws:
      IOException
    • decode7To16

      private static void decode7To16(IndexInput in, long[] tmp, long[] longs) throws IOException
      Throws:
      IOException
    • decode8To16

      private static void decode8To16(IndexInput in, long[] longs) throws IOException
      Throws:
      IOException
    • decode12To32

      private static void decode12To32(IndexInput in, long[] tmp, long[] longs) throws IOException
      Throws:
      IOException
    • decode13To32

      private static void decode13To32(IndexInput in, long[] tmp, long[] longs) throws IOException
      Throws:
      IOException
    • decode14To32

      private static void decode14To32(IndexInput in, long[] tmp, long[] longs) throws IOException
      Throws:
      IOException
    • decode15To32

      private static void decode15To32(IndexInput in, long[] tmp, long[] longs) throws IOException
      Throws:
      IOException
    • decode16To32

      private static void decode16To32(IndexInput in, long[] longs) throws IOException
      Throws:
      IOException