STXXL  1.4.0
 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...
 
uint64 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 Tp >
const Tp & stxxl::STXXL_MAX (const Tp &a, const Tp &b)
 
template<typename Tp >
const Tp & stxxl::STXXL_MIN (const Tp &a, const Tp &b)
 
template<class T >
void stxxl::swap_1D_arrays (T *a, T *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 41 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 226 of file utils.h.

Referenced by stxxl::buffered_writer< stxxl::typed_block >::get_free_block(), stxxl::sort_helper::run_cursor2_cmp< block_type, prefetcher_type, value_cmp >::operator()(), stxxl::ksort_local::run_cursor2_cmp< block_type, prefetcher_type, key_extractor >::operator()(), stxxl::vector_bufwriter< VectorIteratorType >::operator*(), stxxl::buf_ostream< BlockType, BIDIteratorType >::operator++(), stxxl::run_cursor2< block_type, prefetcher_type_ >::operator++(), stxxl::buf_istream< BlockType, BIDIteratorType >::operator++(), stxxl::buf_istream_reverse< BlockType, BIDIteratorType >::operator++(), stxxl::uint_pair< HighType >::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(), and stxxl::sequence< ValueType, BlockSize, AllocStr, SizeType >::push_front().