I am looking for a bit-packing like schemed for compressing integers, then I came across the PinterIntPair part of the LLVM project, however I couldn't figure out exactly how this is done. Would anyone elaborate more about it!
They explain:
PointerIntPair - This class implements a pair of a pointer and small integer. It is designed to represent this in the space required by one pointer by bitmangling the integer into the low part of the pointer. This can only be done for small integers: typically up to 3 bits, but it depends on the number of bits available according to PointerLikeTypeTraits for the type.