STXXL  1.4-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
uint_types.h File Reference
#include <stxxl/bits/config.h>
#include <stxxl/bits/namespace.h>
#include <stxxl/bits/common/utils.h>
#include <stxxl/bits/common/types.h>
#include <limits>
#include <ostream>
#include <cassert>

Go to the source code of this file.

Classes

class  std::numeric_limits< stxxl::uint_pair< HighType > >
 template class providing some numeric_limits fields for uint_pair types. More...
 
class  stxxl::uint_pair< HighType >
 Construct an 40-bit or 48-bit unsigned integer stored in five or six bytes. More...
 

Namespaces

 stxxl
 STXXL library namespace
 

Typedefs

typedef HighType high_type
 higher part type, currently either 8-bit or 16-bit More...
 
typedef uint32 low_type
 lower part type, always 32-bit More...
 
typedef uint_pair< uint8 > stxxl::uint40
 Construct a 40-bit unsigned integer stored in five bytes. More...
 
typedef uint_pair< uint16 > stxxl::uint48
 Construct a 48-bit unsigned integer stored in six bytes. More...
 

Functions

template<typename HighType >
class stxxl::uint_pair stxxl::__attribute__ ((packed))
 
static unsigned_type high_max ()
 return highest value storable in higher part, also used as a mask. More...
 
static unsigned_type low_max ()
 return highest value storable in lower part, also used as a mask. More...
 
static uint_pair max ()
 return an uint_pair instance containing the largest value possible More...
 
static uint_pair min ()
 return an uint_pair instance containing the smallest value possible More...
 
 operator uint64 () const
 implicit cast to an unsigned long long More...
 
bool operator!= (const uint_pair &b) const
 inequality checking operator More...
 
uint_pairoperator++ ()
 prefix increment operator (directly manipulates the integer parts) More...
 
uint_pairoperator+= (const uint_pair &b)
 addition operator (uses 64-bit arithmetic) More...
 
uint_pairoperator-- ()
 prefix decrement operator (directly manipulates the integer parts) More...
 
bool operator< (const uint_pair &b) const
 less-than comparison operator More...
 
std::ostream & operator<< (std::ostream &os, const uint_pair &a)
 make a uint_pair outputtable via iostreams, using unsigned long long. More...
 
bool operator<= (const uint_pair &b) const
 less-or-equal comparison operator More...
 
bool operator== (const uint_pair &b) const
 equality checking operator More...
 
bool operator> (const uint_pair &b) const
 greater comparison operator More...
 
bool operator>= (const uint_pair &b) const
 greater-or-equal comparison operator More...
 
uint64 u64 () const
 return the number as a uint64 More...
 
 uint_pair ()
 empty constructor, does not even initialize to zero! More...
 
 uint_pair (const low_type &l, const high_type &h)
 construct unit pair from lower and higher parts. More...
 
 uint_pair (const uint_pair &a)
 copy constructor More...
 
 uint_pair (const uint32 &a)
 const from a simple 32-bit unsigned integer More...
 
 uint_pair (const int32 &a)
 const from a simple 32-bit signed integer More...
 
 uint_pair (const uint64 &a)
 construct from an uint64 (unsigned long long) More...
 
uint64 ull () const
 return the number as an uint64 (unsigned long long) More...
 

Variables

class std::numeric_limits
< stxxl::uint_pair< HighType > > 
std::__attribute__
 
static const size_t bytes = sizeof(low_type) + sizeof(high_type)
 number of bytes in uint_pair More...
 
static const size_t digits = low_bits + high_bits
 number of binary digits (bits) in uint_pair More...
 
high_type high
 member containing higher significant integer value More...
 
static const size_t high_bits = 8 * sizeof(high_type)
 number of bits in the higher integer part, used a bit shift value. More...
 
low_type low
 member containing lower significant integer value More...
 
static const size_t low_bits = 8 * sizeof(low_type)
 number of bits in the lower integer part, used a bit shift value. More...
 

Typedef Documentation

typedef HighType high_type

higher part type, currently either 8-bit or 16-bit

Definition at line 65 of file uint_types.h.

typedef uint32 low_type

lower part type, always 32-bit

Definition at line 63 of file uint_types.h.

Function Documentation

static unsigned_type __attribute__::high_max ( )
staticprivate

return highest value storable in higher part, also used as a mask.

Definition at line 83 of file uint_types.h.

Referenced by stxxl::uint_pair< HighType >::operator+=(), and uint_pair().

static unsigned_type __attribute__::low_max ( )
staticprivate

return highest value storable in lower part, also used as a mask.

Definition at line 74 of file uint_types.h.

Referenced by stxxl::uint_pair< HighType >::operator+=(), stxxl::uint_pair< HighType >::operator--(), and u64().

static uint_pair __attribute__::max ( )
static

return an uint_pair instance containing the largest value possible

Examples:
examples/algo/copy_and_sort_file.cpp, examples/algo/phonebills.cpp, examples/algo/phonebills_genlog.cpp, examples/algo/sort_file.cpp, examples/applications/skew3.cpp, examples/containers/pqueue1.cpp, examples/containers/sorter1.cpp, examples/containers/sorter2.cpp, and examples/containers/unordered_map1.cpp.

Definition at line 241 of file uint_types.h.

Referenced by stxxl::hash_map::hash_map< KeyType, MappedType, HashType, CompareType, SubBlockSize, SubBlocksPerBlock, AllocType >::_bkt_num(), stxxl::mem_file::discard(), stxxl::uint_pair< HighType >::high_max(), stxxl::new_alloc< Type >::max_size(), stxxl::hash_map::hash_map< KeyType, MappedType, HashType, CompareType, SubBlockSize, SubBlocksPerBlock, AllocType >::max_size(), stxxl::btree::btree< KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy >::max_size(), stxxl::deque< ValueType, VectorType >::max_size(), stxxl::tuple< typename Input1::value_type, typename Input2::value_type, typename Input3::value_type, typename Input4::value_type >::max_value(), stxxl::tuple< T1, Plug, Plug, Plug, Plug >::max_value(), stxxl::tuple< T1, T2, Plug, Plug, Plug, Plug >::max_value(), stxxl::tuple< T1, T2, T3, Plug, Plug, Plug >::max_value(), stxxl::tuple< T1, T2, T3, T4, Plug, Plug >::max_value(), stxxl::tuple< T1, T2, T3, T4, T5, Plug >::max_value(), stxxl::hash_map::hash_map< KeyType, MappedType, HashType, KeyCompareType, SubBlockSize, SubBlocksPerBlock, AllocatorType >::Cmp::max_value(), min(), stxxl::parallel::multiseq_partition(), stxxl::parallel::multiseq_selection(), stxxl::block_scheduler_algorithm_offline_lfd< SwappableBlockType >::priority::priority(), stxxl::syscall_file::serve(), stxxl::custom_stats_counter< ValueType >::set_max(), stxxl::mem_file::set_size(), and stxxl::swap_vector< external_array_type >::swap_back().

static uint_pair __attribute__::min ( )
static

return an uint_pair instance containing the smallest value possible

Examples:
examples/algo/copy_and_sort_file.cpp, examples/algo/phonebills.cpp, examples/algo/phonebills_genlog.cpp, examples/algo/sort_file.cpp, examples/containers/map1.cpp, examples/containers/pqueue2.cpp, examples/containers/sorter1.cpp, examples/containers/sorter2.cpp, and examples/containers/unordered_map1.cpp.

Definition at line 234 of file uint_types.h.

References max(), and uint_pair().

Referenced by stxxl::matrix_local::matrix_operations< ValueType, BlockSideLength >::choose_level_for_feedable_sw(), stxxl::block_scheduler< SwappableBlockType >::get_free_internal_block(), std::numeric_limits< stxxl::uint_pair< HighType > >::lowest(), stxxl::matrix_local::matrix_operations< ValueType, BlockSideLength >::matrix_col_vector_multiply_and_add_swappable_block(), stxxl::matrix_local::matrix_operations< ValueType, BlockSideLength >::matrix_from_vectors_swappable_block(), stxxl::matrix_local::matrix_operations< ValueType, BlockSideLength >::matrix_row_vector_multiply_and_add_swappable_block(), stxxl::tuple< typename Input1::value_type, typename Input2::value_type, typename Input3::value_type, typename Input4::value_type >::min_value(), stxxl::tuple< T1, Plug, Plug, Plug, Plug >::min_value(), stxxl::tuple< T1, T2, Plug, Plug, Plug, Plug >::min_value(), stxxl::tuple< T1, T2, T3, Plug, Plug, Plug >::min_value(), stxxl::tuple< T1, T2, T3, T4, Plug, Plug >::min_value(), stxxl::tuple< T1, T2, T3, T4, T5, Plug >::min_value(), stxxl::hash_map::hash_map< KeyType, MappedType, HashType, KeyCompareType, SubBlockSize, SubBlocksPerBlock, AllocatorType >::Cmp::min_value(), stxxl::matrix_local::matrix_operations< ValueType, BlockSideLength >::multi_level_strassen_winograd_multiply_and_add(), stxxl::matrix_local::matrix_operations< ValueType, BlockSideLength >::multi_level_strassen_winograd_multiply_and_add_block_grained(), stxxl::parallel::multiseq_partition(), stxxl::parallel::multiseq_selection(), stxxl::parallel::multiway_merge_3_combined(), stxxl::parallel::multiway_merge_4_combined(), stxxl::parallel::multiway_merge_loser_tree(), stxxl::parallel::multiway_merge_loser_tree_combined(), stxxl::parallel::multiway_merge_loser_tree_unguarded(), operator<<(), stxxl::parallel_priority_queue< ValueType, CompareType, AllocStrategy, BlockSize, DefaultMemSize, MaxItems >::pop(), stxxl::parallel::prepare_unguarded(), stxxl::parallel_priority_queue< ValueType, CompareType, AllocStrategy, BlockSize, DefaultMemSize, MaxItems >::top(), stxxl::ppq_local::external_array< ValueType, BlockSize, AllocStrategy >::wait_all_hinted_blocks(), and stxxl::ppq_local::external_array< ValueType, BlockSize, AllocStrategy >::wait_next_blocks().

__attribute__::operator uint64 ( ) const
inline

implicit cast to an unsigned long long

Definition at line 151 of file uint_types.h.

References high, low, and low_bits.

uint_pair& __attribute__::operator+= ( const uint_pair b)
inline

addition operator (uses 64-bit arithmetic)

Definition at line 183 of file uint_types.h.

uint_pair& __attribute__::operator-- ( )
inline
bool __attribute__::operator< ( const uint_pair b) const
inline

less-than comparison operator

Examples:
examples/algo/copy_and_sort_file.cpp, and examples/algo/sort_file.cpp.

Definition at line 204 of file uint_types.h.

References stxxl::uint_pair< HighType >::high, high, stxxl::uint_pair< HighType >::low, and low.

friend std::ostream& __attribute__::operator<< ( std::ostream &  os,
const uint_pair a 
)

make a uint_pair outputtable via iostreams, using unsigned long long.

Examples:
examples/algo/copy_and_sort_file.cpp, examples/algo/phonebills.cpp, examples/algo/phonebills_genlog.cpp, and examples/algo/sort_file.cpp.

Definition at line 228 of file uint_types.h.

References min(), and uint_pair().

Referenced by stxxl::buf_ostream< BlockType, BidIteratorType >::fill().

bool __attribute__::operator<= ( const uint_pair b) const
inline

less-or-equal comparison operator

Definition at line 210 of file uint_types.h.

References stxxl::uint_pair< HighType >::high, high, stxxl::uint_pair< HighType >::low, and low.

bool __attribute__::operator> ( const uint_pair b) const
inline

greater comparison operator

Definition at line 216 of file uint_types.h.

References stxxl::uint_pair< HighType >::high, high, stxxl::uint_pair< HighType >::low, and low.

bool __attribute__::operator>= ( const uint_pair b) const
inline

greater-or-equal comparison operator

Definition at line 222 of file uint_types.h.

References stxxl::uint_pair< HighType >::ull().

uint64 __attribute__::u64 ( ) const
inline

return the number as a uint64

Definition at line 157 of file uint_types.h.

References high, low, low_max(), and UNLIKELY.

__attribute__::uint_pair ( )
inline

empty constructor, does not even initialize to zero!

Definition at line 99 of file uint_types.h.

Referenced by min(), and operator<<().

__attribute__::uint_pair ( const low_type l,
const high_type h 
)
inline

construct unit pair from lower and higher parts.

Definition at line 111 of file uint_types.h.

__attribute__::uint_pair ( const uint_pair &  a)
inline

copy constructor

Definition at line 116 of file uint_types.h.

__attribute__::uint_pair ( const uint32 &  a)
inline

const from a simple 32-bit unsigned integer

Definition at line 121 of file uint_types.h.

References high, high_max(), and low.

__attribute__::uint_pair ( const int32 &  a)
inline

const from a simple 32-bit signed integer

Definition at line 126 of file uint_types.h.

__attribute__::uint_pair ( const uint64 &  a)
inline

construct from an uint64 (unsigned long long)

Definition at line 136 of file uint_types.h.

uint64 __attribute__::ull ( ) const
inline

return the number as an uint64 (unsigned long long)

Definition at line 145 of file uint_types.h.

Variable Documentation

const size_t bytes = sizeof(low_type) + sizeof(high_type)
static
const size_t digits = low_bits + high_bits
static

number of binary digits (bits) in uint_pair

Definition at line 93 of file uint_types.h.

const size_t high_bits = 8 * sizeof(high_type)
static

number of bits in the higher integer part, used a bit shift value.

Definition at line 89 of file uint_types.h.

Referenced by stxxl::uint_pair< HighType >::uint_pair().

const size_t low_bits = 8 * sizeof(low_type)
static

number of bits in the lower integer part, used a bit shift value.

Definition at line 80 of file uint_types.h.

Referenced by operator uint64(), stxxl::uint_pair< HighType >::operator+=(), stxxl::uint_pair< HighType >::uint_pair(), and stxxl::uint_pair< HighType >::ull().