GEL
2
GEL is a library for Geometry and Linear Algebra
|
The BitMask class is mostly a utility class. More...
#include <BitMask.h>
Public Member Functions | |
BitMask (int _fb, int _lb) | |
BitMask (int num) | |
first bit is 0 mask num bits. | |
BitMask () | |
Mask everything. | |
int | first_bit () const |
get number of first bit in mask | |
int | last_bit () const |
get number of last bit in mask | |
int | no_bits () const |
Return number of masked bits. | |
int | mask (int var) const |
Mask a number. | |
int | mask_shift (int var) const |
Vec3i | mask (const Vec3i &v) const |
Vec3i | maskshift (const Vec3i &v) const |
The BitMask class is mostly a utility class.
The main purpose is to be able to extract a set of bits from an integer. For instance this can be useful if we traverse some tree structure and the integer is the index.
CGLA::BitMask::BitMask | ( | int | _fb, |
int | _lb | ||
) | [inline] |
Mask _fb-_lb+1 bits beginning from _fb. First bit is 0. Say _fb=_lb=0. In this case, mask 1 bit namely 0.
Mask a vector by masking each coordinate.
int CGLA::BitMask::mask_shift | ( | int | var | ) | const [inline] |
Mask a number and shift back so the first bit inside the mask becomes bit 0.
Mask each coord of a vector and shift