Grappa  r3821, hash 22cd626d567a91ead5b23302066d1e9469f45c66
bittwiddle Namespace Reference

Functions

template<typename T , unsigned B>
signextend (const T x)
 Sign extension. More...
 
unsigned int log2 (unsigned int v)
 Base 2 log of 32-bit number. More...
 

Function Documentation

unsigned int bittwiddle::log2 ( unsigned int  v)
inline

Base 2 log of 32-bit number.

Modified from Stanford bit twiddling hacks.

Definition at line 172 of file common.hpp.

template<typename T , unsigned B>
T bittwiddle::signextend ( const T  x)
inline

Sign extension.

From Stanford bit-twiddling hacks.

Definition at line 164 of file common.hpp.