GEL  2
GEL is a library for Geometry and Linear Algebra
Public Member Functions
CGLA::BitMask Class Reference

The BitMask class is mostly a utility class. More...

#include <BitMask.h>

List of all members.

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

Detailed Description

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

Vec3i CGLA::BitMask::mask ( const Vec3i v) const [inline]

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.

Vec3i CGLA::BitMask::maskshift ( const Vec3i v) const [inline]

Mask each coord of a vector and shift


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations