Grappa  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 173 of file common.hpp.

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

Sign extension.

From Stanford bit-twiddling hacks.

Definition at line 165 of file common.hpp.