CUDPP  2.1
CUDA Data-Parallel Primitives Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Classes | Functions
cudpp_util.h File Reference

C++ utility functions and classes used internally to cuDPP. More...

#include <cuda.h>
#include <cudpp.h>
#include <limits.h>
#include <float.h>

Classes

struct  typeToVector< T, N >
 Utility template struct for generating small vector types from scalar types. More...
 

Functions

bool isPowerOfTwo (int n)
 Determine if n is a power of two. More...
 
bool isMultiple (int n, int f)
 Determine if an integer n is a multiple of an integer f. More...
 
unsigned int ceilPow2 (unsigned int x)
 Compute the smallest power of two larger than x. More...
 
unsigned int floorPow2 (unsigned int x)
 Compute the largest power of two smaller than or equal to x. More...
 
unsigned int logBase2Pow2 (unsigned int x)
 Compute the base 2 logarithm of a power-of-2 integerx. Taken from: http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog. More...
 
template<class T >
__host__ __device__ T getMax ()
 Returns the maximum value for type T. More...
 
template<class T >
__host__ __device__ T getMin ()
 Returns the minimum value for type T. More...
 
template<class T >
int max3 (T a, T b, T c)
 Returns the maximum of three values. More...
 

Detailed Description

C++ utility functions and classes used internally to cuDPP.

cudpp_util.h

Function Documentation

bool isPowerOfTwo ( int  n)
inline

Determine if n is a power of two.

Parameters
nValue to be checked to see if it is a power of two
Returns
True if n is a power of two, false otherwise
bool isMultiple ( int  n,
int  f 
)
inline

Determine if an integer n is a multiple of an integer f.

Parameters
nMultiple
fFactor
Returns
True if n is a multiple of f, false otherwise
unsigned int ceilPow2 ( unsigned int  x)
inline

Compute the smallest power of two larger than x.

Parameters
xInput value
Returns
The smallest power f two larger than x
unsigned int floorPow2 ( unsigned int  x)
inline

Compute the largest power of two smaller than or equal to x.

Parameters
xInput value
Returns
The largest power of two smaller than or equal to x.
unsigned int logBase2Pow2 ( unsigned int  x)
inline

Compute the base 2 logarithm of a power-of-2 integerx. Taken from: http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog.

Parameters
xInput value
Returns
The log base 2 of x.
template<class T >
__host__ __device__ T getMax ( )
inline

Returns the maximum value for type T.

Returns
Maximum value for type T.

Implemented using template specialization on T.

template<class T >
__host__ __device__ T getMin ( )
inline

Returns the minimum value for type T.

Returns
Minimum value for type T.

Implemented using template specialization on T.

template<class T >
int max3 ( a,
b,
c 
)
inline

Returns the maximum of three values.

Parameters
aFirst value.
bSecond value.
cThird value.
Returns
The maximum of a, b and c.