Package me.lemire.integercompression
Class Util
java.lang.Object
me.lemire.integercompression.Util
Routine utility functions.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
bits
(int i) Compute the integer logarithms (ceil(log(x+1)) of a valuestatic int
greatestMultiple
(int value, int factor) return floor(value / factor) * factorstatic int
maxbits
(int[] i, int pos, int length) Compute the maximum of the integer logarithms (ceil(log(x+1)) of a range of valueprotected 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 valueprotected 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)
-
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 arraypos
- starting positionlength
- 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 deltasi
- source arraypos
- starting positionlength
- 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
- numeratorfactor
- denominator- Returns:
- greatest multiple of factor no larger than value
-