LogCabin
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Functions
LogCabin::Core::Util Namespace Reference

Classes

class  Finally
 Calls a function when this object goes out of scope. More...
class  ThreadInterruptedException
 The thread could not complete its task because it was asked to exit. More...

Functions

bool isPowerOfTwo (uint64_t x)
 Return true if the log of x in base 2 is a whole number.
void * memcpy (void *dest, std::initializer_list< std::pair< const void *, size_t >> src)
 Copy some noncontiguous chunks of data into a contiguous chunk.
template<typename Small , typename Large >
Small downCast (const Large &large)
 Cast a bigger int down to a smaller one.

Function Documentation

bool LogCabin::Core::Util::isPowerOfTwo ( uint64_t  x)

Return true if the log of x in base 2 is a whole number.

Definition at line 25 of file Util.cc.

void * LogCabin::Core::Util::memcpy ( void *  dest,
std::initializer_list< std::pair< const void *, size_t >>  src 
)

Copy some noncontiguous chunks of data into a contiguous chunk.

Parameters:
destWhere the new copy should be written.
srcA list of (pointer, length) pairs describing where to copy from.
Returns:
dest (as in memcpy).

Definition at line 34 of file Util.cc.

template<typename Small , typename Large >
Small LogCabin::Core::Util::downCast ( const Large &  large)

Cast a bigger int down to a smaller one.

Asserts that no precision is lost at runtime.

Definition at line 42 of file Util.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines