Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
+ Collaboration diagram for Math Functions:

Functions

template<typename T >
T abs_diff (const T &a, const T &b)
 absolute difference, which also works for unsigned types More...
 
static uint16_t bswap16 (const uint16_t &v)
 bswap16 - generic More...
 
static uint16_t bswap16_generic (const uint16_t &x)
 bswap16 - generic implementation More...
 
static uint32_t bswap32 (const uint32_t &v)
 bswap32 - generic More...
 
static uint32_t bswap32_generic (const uint32_t &x)
 bswap32 - generic implementation More...
 
static uint64_t bswap64 (const uint64_t &v)
 bswap64 - generic More...
 
static uint64_t bswap64_generic (const uint64_t &x)
 bswap64 - generic implementation More...
 
template<typename Integral >
unsigned clz (Integral x)
 
template<>
unsigned clz< int > (int i)
 clz (count leading zeros) More...
 
template<>
unsigned clz< long > (long i)
 clz (count leading zeros) More...
 
template<>
unsigned clz< long long > (long long i)
 clz (count leading zeros) More...
 
template<>
unsigned clz< unsigned > (unsigned i)
 clz (count leading zeros) More...
 
template<>
unsigned clz< unsigned long > (unsigned long i)
 clz (count leading zeros) More...
 
template<>
unsigned clz< unsigned long long > (unsigned long long i)
 clz (count leading zeros) More...
 
template<typename Integral >
static unsigned clz_template (Integral x)
 clz (count leading zeros) - generic implementation More...
 
template<typename IntegralN , typename IntegralK >
static constexpr auto div_ceil (const IntegralN &n, const IntegralK &k) -> decltype(n+k)
 calculate n div k with rounding up More...
 
static unsigned ffs (int i)
 find first set bit in integer, or zero if none are set. More...
 
static unsigned ffs (unsigned int i)
 find first set bit in integer, or zero if none are set. More...
 
static unsigned ffs (long i)
 find first set bit in integer, or zero if none are set. More...
 
static unsigned ffs (unsigned long i)
 find first set bit in integer, or zero if none are set. More...
 
static unsigned ffs (long long i)
 find first set bit in integer, or zero if none are set. More...
 
static unsigned ffs (unsigned long long i)
 find first set bit in integer, or zero if none are set. More...
 
template<typename Integral >
static unsigned ffs_template (Integral x)
 ffs (find first set bit) - generic implementation More...
 
unsigned integer_log2_ceil (int i)
 calculate the log2 ceiling of an integer type (by repeated bit shifts) More...
 
unsigned integer_log2_ceil (unsigned int i)
 calculate the log2 ceiling of an integer type (by repeated bit shifts) More...
 
unsigned integer_log2_ceil (long i)
 calculate the log2 ceiling of an integer type (by repeated bit shifts) More...
 
unsigned integer_log2_ceil (unsigned long i)
 calculate the log2 ceiling of an integer type (by repeated bit shifts) More...
 
unsigned integer_log2_ceil (long long i)
 calculate the log2 ceiling of an integer type (by repeated bit shifts) More...
 
unsigned integer_log2_ceil (unsigned long long i)
 calculate the log2 ceiling of an integer type (by repeated bit shifts) More...
 
unsigned integer_log2_floor (int i)
 calculate the log2 floor of an integer type (by repeated bit shifts) More...
 
unsigned integer_log2_floor (unsigned int i)
 calculate the log2 floor of an integer type (by repeated bit shifts) More...
 
unsigned integer_log2_floor (long i)
 calculate the log2 floor of an integer type (by repeated bit shifts) More...
 
unsigned integer_log2_floor (unsigned long i)
 calculate the log2 floor of an integer type (by repeated bit shifts) More...
 
unsigned integer_log2_floor (long long i)
 calculate the log2 floor of an integer type (by repeated bit shifts) More...
 
unsigned integer_log2_floor (unsigned long long i)
 calculate the log2 floor of an integer type (by repeated bit shifts) More...
 
template<typename IntegerType >
static unsigned integer_log2_floor_template (IntegerType i)
 calculate the log2 floor of an integer type (by repeated bit shifts) More...
 
bool is_power_of_two (int i)
 does what it says: true if i is a power of two More...
 
bool is_power_of_two (unsigned int i)
 does what it says: true if i is a power of two More...
 
bool is_power_of_two (long i)
 does what it says: true if i is a power of two More...
 
bool is_power_of_two (unsigned long i)
 does what it says: true if i is a power of two More...
 
bool is_power_of_two (long long i)
 does what it says: true if i is a power of two More...
 
bool is_power_of_two (unsigned long long i)
 does what it says: true if i is a power of two More...
 
static uint32_t rol32 (const uint32_t &x, int i)
 rol32 - generic More...
 
static uint32_t rol32_generic (const uint32_t &x, int i)
 rol32 - generic implementation More...
 
static uint64_t rol64 (const uint64_t &x, int i)
 rol64 - generic More...
 
static uint64_t rol64_generic (const uint64_t &x, int i)
 rol64 - generic implementation More...
 
static uint32_t ror32 (const uint32_t &x, int i)
 ror32 - generic More...
 
static uint32_t ror32_generic (const uint32_t &x, int i)
 ror32 - generic implementation More...
 
static uint64_t ror64 (const uint64_t &x, int i)
 ror64 - generic More...
 
static uint64_t ror64_generic (const uint64_t &x, int i)
 ror64 - generic implementation More...
 
int round_down_to_power_of_two (int i)
 does what it says: round down to next power of two More...
 
unsigned int round_down_to_power_of_two (unsigned int i)
 does what it says: round down to next power of two More...
 
long round_down_to_power_of_two (long i)
 does what it says: round down to next power of two More...
 
unsigned long round_down_to_power_of_two (unsigned long i)
 does what it says: round down to next power of two More...
 
long long round_down_to_power_of_two (long long i)
 does what it says: round down to next power of two More...
 
unsigned long long round_down_to_power_of_two (unsigned long long i)
 does what it says: round down to next power of two More...
 
int round_up_to_power_of_two (int i)
 does what it says: round up to next power of two More...
 
unsigned int round_up_to_power_of_two (unsigned int i)
 does what it says: round up to next power of two More...
 
long round_up_to_power_of_two (long i)
 does what it says: round up to next power of two More...
 
unsigned long round_up_to_power_of_two (unsigned long i)
 does what it says: round up to next power of two More...
 
long long round_up_to_power_of_two (long long i)
 does what it says: round up to next power of two More...
 
unsigned long long round_up_to_power_of_two (unsigned long long i)
 does what it says: round up to next power of two More...
 

Detailed Description

Simple math functions

Function Documentation

T tlx::abs_diff ( const T a,
const T b 
)

absolute difference, which also works for unsigned types

Definition at line 24 of file abs_diff.hpp.

Referenced by Context::Launch(), and MergeNode< ValueType, Comparator, kNumInputs >::MainOp().

static uint16_t tlx::bswap16 ( const uint16_t &  v)
inlinestatic

bswap16 - generic

Definition at line 52 of file bswap.hpp.

References tlx::bswap16_generic().

static uint16_t tlx::bswap16_generic ( const uint16_t &  x)
inlinestatic

bswap16 - generic implementation

Definition at line 31 of file bswap.hpp.

Referenced by tlx::bswap16().

static uint32_t tlx::bswap32 ( const uint32_t &  v)
inlinestatic

bswap32 - generic

Definition at line 84 of file bswap.hpp.

References tlx::bswap32_generic().

static uint32_t tlx::bswap32_generic ( const uint32_t &  x)
inlinestatic

bswap32 - generic implementation

Definition at line 62 of file bswap.hpp.

Referenced by tlx::bswap32().

static uint64_t tlx::bswap64 ( const uint64_t &  v)
inlinestatic

bswap64 - generic

Definition at line 122 of file bswap.hpp.

References tlx::bswap64_generic().

static uint64_t tlx::bswap64_generic ( const uint64_t &  x)
inlinestatic

bswap64 - generic implementation

Definition at line 94 of file bswap.hpp.

Referenced by tlx::bswap64().

unsigned tlx::clz< int > ( int  i)
inline

clz (count leading zeros)

Definition at line 105 of file clz.hpp.

References tlx::clz_template().

unsigned tlx::clz< long > ( long  i)
inline

clz (count leading zeros)

Definition at line 117 of file clz.hpp.

References tlx::clz_template().

unsigned tlx::clz< long long > ( long long  i)
inline

clz (count leading zeros)

Definition at line 129 of file clz.hpp.

References tlx::clz_template().

unsigned tlx::clz< unsigned > ( unsigned  i)
inline

clz (count leading zeros)

Definition at line 111 of file clz.hpp.

References tlx::clz_template().

unsigned tlx::clz< unsigned long > ( unsigned long  i)
inline

clz (count leading zeros)

Definition at line 123 of file clz.hpp.

References tlx::clz_template().

unsigned tlx::clz< unsigned long long > ( unsigned long long  i)
inline

clz (count leading zeros)

Definition at line 135 of file clz.hpp.

References tlx::clz_template().

static unsigned tlx::clz_template ( Integral  x)
inlinestatic

clz (count leading zeros) - generic implementation

Definition at line 30 of file clz.hpp.

References gen_data::x.

Referenced by tlx::clz< int >(), tlx::clz< long >(), tlx::clz< long long >(), tlx::clz< unsigned >(), tlx::clz< unsigned long >(), and tlx::clz< unsigned long long >().

static constexpr auto tlx::div_ceil ( const IntegralN &  n,
const IntegralK &  k 
) -> decltype(n + k)
inlinestatic

calculate n div k with rounding up

Definition at line 25 of file div_ceil.hpp.

static unsigned tlx::ffs ( int  i)
inlinestatic

find first set bit in integer, or zero if none are set.

Definition at line 79 of file ffs.hpp.

References tlx::ffs_template().

Referenced by Group::BroadcastBinomialTree().

static unsigned tlx::ffs ( unsigned int  i)
inlinestatic

find first set bit in integer, or zero if none are set.

Definition at line 85 of file ffs.hpp.

References tlx::ffs_template().

static unsigned tlx::ffs ( long  i)
inlinestatic

find first set bit in integer, or zero if none are set.

Definition at line 91 of file ffs.hpp.

References tlx::ffs_template().

static unsigned tlx::ffs ( unsigned long  i)
inlinestatic

find first set bit in integer, or zero if none are set.

Definition at line 97 of file ffs.hpp.

References tlx::ffs_template().

static unsigned tlx::ffs ( long long  i)
inlinestatic

find first set bit in integer, or zero if none are set.

Definition at line 103 of file ffs.hpp.

References tlx::ffs_template().

static unsigned tlx::ffs ( unsigned long long  i)
inlinestatic

find first set bit in integer, or zero if none are set.

Definition at line 109 of file ffs.hpp.

References tlx::ffs_template().

static unsigned tlx::ffs_template ( Integral  x)
inlinestatic

ffs (find first set bit) - generic implementation

Definition at line 27 of file ffs.hpp.

Referenced by tlx::ffs().

unsigned integer_log2_ceil ( unsigned int  i)

calculate the log2 ceiling of an integer type (by repeated bit shifts)

Definition at line 48 of file integer_log2.cpp.

References tlx::integer_log2_floor().

unsigned integer_log2_ceil ( long  i)

calculate the log2 ceiling of an integer type (by repeated bit shifts)

Definition at line 53 of file integer_log2.cpp.

References tlx::integer_log2_floor().

unsigned integer_log2_ceil ( unsigned long  i)

calculate the log2 ceiling of an integer type (by repeated bit shifts)

Definition at line 58 of file integer_log2.cpp.

References tlx::integer_log2_floor().

unsigned integer_log2_ceil ( long long  i)

calculate the log2 ceiling of an integer type (by repeated bit shifts)

Definition at line 63 of file integer_log2.cpp.

References tlx::integer_log2_floor().

unsigned integer_log2_ceil ( unsigned long long  i)

calculate the log2 ceiling of an integer type (by repeated bit shifts)

Definition at line 68 of file integer_log2.cpp.

References tlx::integer_log2_floor().

unsigned integer_log2_floor ( int  i)

calculate the log2 floor of an integer type (by repeated bit shifts)

Definition at line 17 of file integer_log2.cpp.

References tlx::integer_log2_floor_template().

Referenced by Sampling< RNG >::hash_sample(), tlx::integer_log2_ceil(), and examples::suffix_sorting::PrefixDoublingPack().

unsigned integer_log2_floor ( unsigned int  i)

calculate the log2 floor of an integer type (by repeated bit shifts)

Definition at line 21 of file integer_log2.cpp.

References tlx::integer_log2_floor_template().

unsigned integer_log2_floor ( long  i)

calculate the log2 floor of an integer type (by repeated bit shifts)

Definition at line 25 of file integer_log2.cpp.

References tlx::integer_log2_floor_template().

unsigned integer_log2_floor ( unsigned long  i)

calculate the log2 floor of an integer type (by repeated bit shifts)

Definition at line 29 of file integer_log2.cpp.

References tlx::integer_log2_floor_template().

unsigned integer_log2_floor ( long long  i)

calculate the log2 floor of an integer type (by repeated bit shifts)

Definition at line 33 of file integer_log2.cpp.

References tlx::integer_log2_floor_template().

unsigned integer_log2_floor ( unsigned long long  i)

calculate the log2 floor of an integer type (by repeated bit shifts)

Definition at line 37 of file integer_log2.cpp.

References tlx::integer_log2_floor_template().

static unsigned tlx::integer_log2_floor_template ( IntegerType  i)
inlinestatic

calculate the log2 floor of an integer type (by repeated bit shifts)

Definition at line 24 of file integer_log2.hpp.

Referenced by thrill::mem::calc_bin_for_size(), and tlx::integer_log2_floor().

bool is_power_of_two ( int  i)

does what it says: true if i is a power of two

Definition at line 23 of file is_power_of_two.cpp.

References tlx::is_power_of_two_template().

Referenced by FlowControlChannel::AllGather(), and BlockPool::AllocateByteBlock().

bool is_power_of_two ( unsigned int  i)

does what it says: true if i is a power of two

Definition at line 27 of file is_power_of_two.cpp.

References tlx::is_power_of_two_template().

bool is_power_of_two ( long  i)

does what it says: true if i is a power of two

Definition at line 31 of file is_power_of_two.cpp.

References tlx::is_power_of_two_template().

bool is_power_of_two ( unsigned long  i)

does what it says: true if i is a power of two

Definition at line 35 of file is_power_of_two.cpp.

References tlx::is_power_of_two_template().

bool is_power_of_two ( long long  i)

does what it says: true if i is a power of two

Definition at line 39 of file is_power_of_two.cpp.

References tlx::is_power_of_two_template().

bool is_power_of_two ( unsigned long long  i)

does what it says: true if i is a power of two

Definition at line 43 of file is_power_of_two.cpp.

References tlx::is_power_of_two_template().

static uint32_t tlx::rol32 ( const uint32_t &  x,
int  i 
)
inlinestatic

rol32 - generic

Definition at line 55 of file rol.hpp.

References tlx::rol32_generic().

static uint32_t tlx::rol32_generic ( const uint32_t &  x,
int  i 
)
inlinestatic

rol32 - generic implementation

Definition at line 31 of file rol.hpp.

Referenced by tlx::rol32().

static uint64_t tlx::rol64 ( const uint64_t &  x,
int  i 
)
inlinestatic

rol64 - generic

Definition at line 89 of file rol.hpp.

References tlx::rol64_generic().

static uint64_t tlx::rol64_generic ( const uint64_t &  x,
int  i 
)
inlinestatic

rol64 - generic implementation

Definition at line 65 of file rol.hpp.

Referenced by tlx::rol64().

static uint32_t tlx::ror32 ( const uint32_t &  x,
int  i 
)
inlinestatic

ror32 - generic

Definition at line 55 of file ror.hpp.

References tlx::ror32_generic().

static uint32_t tlx::ror32_generic ( const uint32_t &  x,
int  i 
)
inlinestatic

ror32 - generic implementation

Definition at line 31 of file ror.hpp.

Referenced by tlx::ror32().

static uint64_t tlx::ror64 ( const uint64_t &  x,
int  i 
)
inlinestatic

ror64 - generic

Definition at line 89 of file ror.hpp.

References tlx::ror64_generic().

static uint64_t tlx::ror64_generic ( const uint64_t &  x,
int  i 
)
inlinestatic

ror64 - generic implementation

Definition at line 65 of file ror.hpp.

Referenced by tlx::ror64().

int round_down_to_power_of_two ( int  i)

does what it says: round down to next power of two

Definition at line 55 of file round_to_power_of_two.cpp.

References tlx::round_up_to_power_of_two().

Referenced by MixStreamData::GetWriters(), and CatStreamData::GetWriters().

unsigned int round_down_to_power_of_two ( unsigned int  i)

does what it says: round down to next power of two

Definition at line 59 of file round_to_power_of_two.cpp.

References tlx::round_up_to_power_of_two().

long round_down_to_power_of_two ( long  i)

does what it says: round down to next power of two

Definition at line 63 of file round_to_power_of_two.cpp.

References tlx::round_up_to_power_of_two().

unsigned long round_down_to_power_of_two ( unsigned long  i)

does what it says: round down to next power of two

Definition at line 67 of file round_to_power_of_two.cpp.

References tlx::round_up_to_power_of_two().

long long round_down_to_power_of_two ( long long  i)

does what it says: round down to next power of two

Definition at line 71 of file round_to_power_of_two.cpp.

References tlx::round_up_to_power_of_two().

unsigned long long round_down_to_power_of_two ( unsigned long long  i)

does what it says: round down to next power of two

Definition at line 75 of file round_to_power_of_two.cpp.

References tlx::round_up_to_power_of_two().

unsigned int round_up_to_power_of_two ( unsigned int  i)

does what it says: round up to next power of two

Definition at line 33 of file round_to_power_of_two.cpp.

References tlx::round_up_to_power_of_two_template().

long round_up_to_power_of_two ( long  i)

does what it says: round up to next power of two

Definition at line 37 of file round_to_power_of_two.cpp.

References tlx::round_up_to_power_of_two_template().

unsigned long round_up_to_power_of_two ( unsigned long  i)

does what it says: round up to next power of two

Definition at line 41 of file round_to_power_of_two.cpp.

References tlx::round_up_to_power_of_two_template().

long long round_up_to_power_of_two ( long long  i)

does what it says: round up to next power of two

Definition at line 45 of file round_to_power_of_two.cpp.

References tlx::round_up_to_power_of_two_template().

unsigned long long round_up_to_power_of_two ( unsigned long long  i)

does what it says: round up to next power of two

Definition at line 49 of file round_to_power_of_two.cpp.

References tlx::round_up_to_power_of_two_template().