Package org.roaringbitmap.longlong
Class RoaringIntPacking
java.lang.Object
org.roaringbitmap.longlong.RoaringIntPacking
Used to hold the logic packing 2 integers in a long, and separating a long in two integers. It is
useful in
Roaring64NavigableMap
as the implementation split the input long in two
integers, one used as key of a NavigableMap while the other is added in a Bitmap-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
compareUnsigned
(int x, int y) Compares twoint
values numerically treating the values as unsigned.static int
high
(long id) static int
highestHigh
(boolean signedLongs) static int
low
(long id) static long
pack
(int high, int low) (package private) static String
toUnsignedString
(long l) JDK8 Long.toUnsignedString was too complex to backport.static Comparator
<Integer>
-
Field Details
-
TWO_64
the constant 2^64
-
-
Constructor Details
-
RoaringIntPacking
RoaringIntPacking()
-
-
Method Details
-
high
public static int high(long id) - Parameters:
id
- any long, positive or negative- Returns:
- an int holding the 32 highest order bits of information of the input long
-
low
public static int low(long id) - Parameters:
id
- any long, positive or negative- Returns:
- an int holding the 32 lowest order bits of information of the input long
-
pack
public static long pack(int high, int low) - Parameters:
high
- an integer representing the highest order bits of the output longlow
- an integer representing the lowest order bits of the output long- Returns:
- a long packing together the integers as computed by
high(long)
andlow(long)
-
highestHigh
public static int highestHigh(boolean signedLongs) - Parameters:
signedLongs
- true if long put in aRoaring64NavigableMap
should be considered as signed long.- Returns:
- the int representing the highest value which can be set as high value in a
Roaring64NavigableMap
-
unsignedComparator
- Returns:
- A comparator for unsigned longs: a negative long is a long greater than Long.MAX_VALUE
-
compareUnsigned
public static int compareUnsigned(int x, int y) Compares twoint
values numerically treating the values as unsigned.- Parameters:
x
- the firstint
to comparey
- the secondint
to compare- Returns:
- the value
0
ifx == y
; a value less than0
ifx < y
as unsigned values; and a value greater than0
ifx > y
as unsigned values - Since:
- 1.8
-
toUnsignedString
JDK8 Long.toUnsignedString was too complex to backport. Go for a slow version relying on BigInteger
-