Class Util

java.lang.Object
me.lemire.integercompression.Util

public final class Util extends Object
Routine utility functions.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    bits(int i)
    Compute the integer logarithms (ceil(log(x+1)) of a value
    static int
    greatestMultiple(int value, int factor)
    return floor(value / factor) * factor
    static int
    maxbits(int[] i, int pos, int length)
    Compute the maximum of the integer logarithms (ceil(log(x+1)) of a range of value
    protected static int
    maxbits32(int[] i, int pos)
     
    static int
    maxdiffbits(int initoffset, int[] i, int pos, int length)
    Compute the maximum of the integer logarithms (ceil(log(x+1)) of a the successive differences (deltas) of a range of value
    protected static int
    pack(int[] outputarray, int arraypos, int[] data, int datapos, int num, int b)
     
    protected static int
    packsize(int num, int b)
     
    protected static int
    packsizew(int num, int b)
     
    protected static int
    packw(int[] outputarray, int arraypos, int[] data, int num, int b)
     
    protected static int
    unpack(int[] sourcearray, int arraypos, int[] data, int datapos, int num, int b)
     
    protected static int
    unpackw(int[] sourcearray, int arraypos, int[] data, int num, int b)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Util

      public Util()
  • Method Details

    • maxbits

      public static int maxbits(int[] i, int pos, int length)
      Compute the maximum of the integer logarithms (ceil(log(x+1)) of a range of value
      Parameters:
      i - source array
      pos - starting position
      length - number of integers to consider
      Returns:
      integer logarithm
    • maxbits32

      protected static int maxbits32(int[] i, int pos)
    • maxdiffbits

      public static int maxdiffbits(int initoffset, int[] i, int pos, int length)
      Compute the maximum of the integer logarithms (ceil(log(x+1)) of a the successive differences (deltas) of a range of value
      Parameters:
      initoffset - initial vallue for the computation of the deltas
      i - source array
      pos - starting position
      length - number of integers to consider
      Returns:
      integer logarithm
    • bits

      public static int bits(int i)
      Compute the integer logarithms (ceil(log(x+1)) of a value
      Parameters:
      i - source value
      Returns:
      integer logarithm
    • packsize

      protected static int packsize(int num, int b)
    • pack

      protected static int pack(int[] outputarray, int arraypos, int[] data, int datapos, int num, int b)
    • unpack

      protected static int unpack(int[] sourcearray, int arraypos, int[] data, int datapos, int num, int b)
    • packsizew

      protected static int packsizew(int num, int b)
    • packw

      protected static int packw(int[] outputarray, int arraypos, int[] data, int num, int b)
    • unpackw

      protected static int unpackw(int[] sourcearray, int arraypos, int[] data, int num, int b)
    • greatestMultiple

      public static int greatestMultiple(int value, int factor)
      return floor(value / factor) * factor
      Parameters:
      value - numerator
      factor - denominator
      Returns:
      greatest multiple of factor no larger than value