STXXL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
utils.h File Reference
#include <vector>
#include <string>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <sstream>
#include <limits>
#include <stxxl/bits/config.h>
#include <stxxl/bits/namespace.h>
#include <stxxl/bits/common/types.h>
#include <stxxl/bits/compat/type_traits.h>
#include <stxxl/bits/msvc_compatibility.h>

Go to the source code of this file.

Namespaces

 stxxl
 STXXL library namespace
 

Macros

#define LIKELY(c)   c
 
#define STXXL_ATTRIBUTE_UNUSED
 
#define STXXL_STATIC_ASSERT(x)   { typedef int static_assert_dummy_type[(x) ? 1 : -1] STXXL_ATTRIBUTE_UNUSED; }
 
#define UNLIKELY(c)   c
 

Functions

stxxl::int64 stxxl::atoi64 (const char *s)
 
stxxl::uint64 stxxl::atouint64 (const char *s)
 
template<typename Integral , typename Integral2 >
compat::remove_const< Integral >
::type 
stxxl::div_ceil (Integral n, Integral2 d)
 
std::string stxxl::format_IEC_size (uint64 number)
 Format a byte size using IEC (Ki, Mi, Gi, Ti) suffixes (powers of two). Returns "123 Ki" or similar. More...
 
std::string stxxl::format_SI_size (uint64 number)
 Format a byte size using SI (K, M, G, T) suffixes (powers of ten). Returns "123 M" or similar. More...
 
template<typename IntegerType >
unsigned int stxxl::ilog2_ceil (const IntegerType &i)
 calculate the log2 ceiling of an integer type (by repeated bit shifts) More...
 
template<typename IntegerType >
unsigned int stxxl::ilog2_floor (IntegerType i)
 calculate the log2 floor of an integer type (by repeated bit shifts) More...
 
template<typename Integral >
Integral stxxl::log2_ceil (Integral i)
 calculate the log2 floor of an integral type using math.h More...
 
template<typename Integral >
Integral stxxl::log2_floor (Integral i)
 calculate the log2 ceiling of an integral type using math.h More...
 
size_t stxxl::longhash1 (uint64 key_)
 
bool stxxl::parse_SI_IEC_size (const std::string &str, uint64 &size, char def_unit=0)
 Parse a string like "343KB" or "44 GiB" into the corresponding size in bytes. Returns the number of bytes and sets ok = true if the string could be parsed correctly. If no units indicator is given, use def_unit in k/m/g/t/p (powers of ten) or in K/M/G/T/P (power of two). More...
 
template<class Container >
Container::value_type stxxl::pop (Container &c)
 
template<class Container >
Container::value_type stxxl::pop_back (Container &c)
 
template<class Container >
Container::value_type stxxl::pop_begin (Container &c)
 
template<class Container >
Container::value_type stxxl::pop_front (Container &c)
 
template<typename Integral >
Integral stxxl::round_up_to_power_of_two (Integral n, unsigned_type power)
 round n up to next larger multiple of 2^power. example: (48,4) = 64, (48,3) = 48. More...
 
static std::vector< std::string > stxxl::split (const std::string &str, const std::string &sep, unsigned int min_fields=0, unsigned int limit_fields=std::numeric_limits< unsigned int >::max())
 Split a string by given separator string. Returns a vector of strings with at least min_fields and at most limit_fields. More...
 
template<typename Type >
const Type & stxxl::STXXL_MAX (const Type &a, const Type &b)
 
template<typename Type >
const Type & stxxl::STXXL_MIN (const Type &a, const Type &b)
 
template<class Type >
void stxxl::swap_1D_arrays (Type *a, Type *b, unsigned_type size)
 
template<typename Type >
std::string stxxl::to_str (const Type &t)
 Format any ostream-able type into a string. More...
 

Macro Definition Documentation

#define STXXL_ATTRIBUTE_UNUSED

Definition at line 40 of file utils.h.

#define STXXL_STATIC_ASSERT (   x)    { typedef int static_assert_dummy_type[(x) ? 1 : -1] STXXL_ATTRIBUTE_UNUSED; }
#define UNLIKELY (   c)    c

Definition at line 225 of file utils.h.

Referenced by stxxl::buffered_writer< block_type >::get_free_block(), stxxl::sort_helper::run_cursor2_cmp< BlockType, PrefetcherType, ValueCmp >::operator()(), stxxl::ksort_local::run_cursor2_cmp< BlockType, prefetcher_type, KeyExtractor >::operator()(), stxxl::vector_bufwriter< VectorIteratorType >::operator*(), stxxl::buf_ostream< BlockType, BidIteratorType >::operator++(), stxxl::run_cursor2< BlockType, PrefetcherType >::operator++(), stxxl::buf_istream< BlockType, BidIteratorType >::operator++(), stxxl::buf_istream_reverse< BlockType, BidIteratorType >::operator++(), stxxl::stream::vector_iterator2stream< InputIterator >::operator++(), stxxl::sequence< ValueType, BlockSize, AllocStr, SizeType >::stream::operator++(), stxxl::sequence< ValueType, BlockSize, AllocStr, SizeType >::reverse_stream::operator++(), stxxl::vector_bufreader< VectorIteratorType >::operator++(), stxxl::vector_bufreader_reverse< VectorIteratorType >::operator++(), stxxl::uint_pair< HighType >::operator--(), stxxl::buf_ostream< BlockType, BidIteratorType >::operator<<(), stxxl::buf_istream< BlockType, BidIteratorType >::operator>>(), stxxl::buf_istream_reverse< BlockType, BidIteratorType >::operator>>(), stxxl::normal_stack< StackConfig >::pop(), stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::pop(), stxxl::grow_shrink_stack< StackConfig >::pop(), stxxl::grow_shrink_stack2< StackConfig >::pop(), stxxl::sequence< ValueType, BlockSize, AllocStr, SizeType >::pop_back(), stxxl::sequence< ValueType, BlockSize, AllocStr, SizeType >::pop_front(), stxxl::normal_stack< StackConfig >::push(), stxxl::queue< ValueType, BlockSize, AllocStr, SizeType >::push(), stxxl::grow_shrink_stack< StackConfig >::push(), stxxl::grow_shrink_stack2< StackConfig >::push(), stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::push(), stxxl::sequence< ValueType, BlockSize, AllocStr, SizeType >::push_back(), stxxl::sequence< ValueType, BlockSize, AllocStr, SizeType >::push_front(), and u64().