RandomLib::RandomPower2 Class Reference

Return or multiply by powers of 2. More...

#include <RandomLib/RandomPower2.hpp>

List of all members.

Public Types

enum  { minpow = -64, maxpow = 64 }

Static Public Member Functions

template<typename RealType >
static RealType pow2 (int n) throw ()
template<typename RealType >
static RealType shiftf (RealType x, int n) throw ()

Static Private Attributes

static const float power2 [maxpow-minpow+1]

Detailed Description

Return or multiply by powers of 2.

With some compilers it's fastest to do a table lookup of powers of 2. If RANDOM_POWERTABLE is 1, a lookup table is used. If RANDOM_POWERTABLE is 0, then std::pow is used.

Definition at line 26 of file RandomPower2.hpp.


Member Enumeration Documentation

anonymous enum
Enumerator:
minpow 

Minimum power in RandomPower2::power2

maxpow 

Maximum power in RandomPower2::power2.

Definition at line 47 of file RandomPower2.hpp.


Member Function Documentation

template<typename RealType >
static RealType RandomLib::RandomPower2::pow2 ( int  n  )  throw () [inline, static]

Return powers of 2 (either using a lookup table or std::pow)

Definition at line 31 of file RandomPower2.hpp.

References minpow, and power2.

template<typename RealType >
static RealType RandomLib::RandomPower2::shiftf ( RealType  x,
int  n 
) throw () [inline, static]

Multiply a real by a power of 2

Definition at line 42 of file RandomPower2.hpp.


Member Data Documentation

const float RandomLib::RandomPower2::power2[maxpow-minpow+1] [static, private]

Table of powers of two

Definition at line 63 of file RandomPower2.hpp.

Referenced by pow2().


The documentation for this class was generated from the following file:

Generated on Thu Dec 31 15:24:30 2009 by  doxygen 1.6.1