LLVM: llvm::PointerEmbeddedInt< IntT, Bits > Class Template Reference (original) (raw)
template<typename IntT, int Bits = sizeof(IntT) * CHAR_BIT>
class llvm::PointerEmbeddedInt< IntT, Bits >
Utility to embed an integer into a pointer-like type.
This is specifically intended to allow embedding integers where fewer bits are required than exist in a pointer, and the integer can participate in abstractions along side other pointer-like types. For example it can be placed into a [PointerSumType](classllvm%5F1%5F1PointerSumType.html "A sum type over pointer-like types.") or [PointerUnion](classllvm%5F1%5F1PointerUnion.html "A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...").
Note that much like pointers, an integer value of zero has special utility due to boolean conversions. For example, a non-null value can be tested for in the above abstractions without testing the particular active member. Also, the default constructed value zero initializes the integer.
Definition at line 33 of file PointerEmbeddedInt.h.