Thrill  0.1
uint_types.hpp File Reference
#include <cassert>
#include <limits>
#include <ostream>
#include <foxxll/common/types.hpp>
#include <foxxll/common/utils.hpp>
#include <foxxll/config.hpp>
#include <tlx/define/likely.hpp>
+ Include dependency graph for uint_types.hpp:

Go to the source code of this file.

Classes

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

Namespaces

 foxxll
 FOXXLL library namespace
 

Typedefs

using high_type = HighType
 higher part type, currently either 8-bit or 16-bit More...
 
using low_type = uint32_t
 lower part type, always 32-bit More...
 
using uint40 = uint_pair< uint8_t >
 Construct a 40-bit unsigned integer stored in five bytes. More...
 
using uint48 = uint_pair< uint16_t >
 Construct a 48-bit unsigned integer stored in six bytes. More...
 

Functions

template<typename HighType >
class foxxll::uint_pair __attribute__ ((packed))
 
static high_type high_max ()
 return highest value storable in higher part, also used as a mask. More...
 
static low_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_t () 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_t u64 () const
 return the number as a uint64_t 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 uint32_t &a)
 implicit conversion from a simple 32-bit unsigned integer More...
 
 uint_pair (const int32_t &a)
 implicit conversion from a simple 32-bit signed integer More...
 
 uint_pair (const uint64_t &a)
 implicit conversion from an uint64_t (unsigned long long) More...
 
uint64_t ull () const
 return the number as an uint64_t (unsigned long long) More...
 

Variables

class std::numeric_limits< foxxll::uint_pair< HighType > > __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

◆ high_type

using high_type = HighType

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

Definition at line 44 of file uint_types.hpp.

◆ low_type

using low_type = uint32_t

lower part type, always 32-bit

Definition at line 42 of file uint_types.hpp.

Function Documentation

◆ high_max()

static high_type __attribute__::high_max ( )
staticprivate

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

Definition at line 62 of file uint_types.hpp.

◆ low_max()

static low_type __attribute__::low_max ( )
staticprivate

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

Definition at line 53 of file uint_types.hpp.

◆ max()

static uint_pair __attribute__::max ( )
static

return an uint_pair instance containing the largest value possible

Definition at line 226 of file uint_types.hpp.

Referenced by AggregateMinMax< Type_ >::add(), Aggregate< Type_ >::add(), Manager::add(), BlockPool::AllocateByteBlock(), tlx::appendline(), buf_istream< BlockType, BidIteratorType >::buf_istream(), buf_istream_reverse< BlockType, BidIteratorType >::buf_istream_reverse(), CmdlineParser::calc_option_max(), CmdlineParser::calc_param_max(), ReservoirSamplingGrow< SampleIndexPair >::calc_sample_size(), thrill::api::Context::GetNewStream< data::MixStream >(), memory_file::discard(), LocationDetection< thrill::api::JoinNode::HashCount >::Flush(), MixStreamData::GetWriters(), CatStreamData::GetWriters(), DAryAddressableIntHeap< KeyType, Arity, Compare >::heapify(), UIntPair< High_ >::high_max(), RadixHeap< ValueType, KeyExtract, KeyType, Radix >::initialize_(), Range::Invalid(), StochasticGradientDescent< Vector >::is_converged(), UIntPair< High_ >::low_max(), main(), BlockPool::MapExternalBlock(), uint_pair< HighType >::max(), UIntPair< High_ >::max(), new_alloc< Type >::max_size(), Pool::max_size(), HyperLogLogRegisters< p >::mergeDense(), PS5SmallsortJob< Context, StringPtr, BktSizeType >::MKQSStep::MKQSStep(), Multiplexer::Multiplexer(), tlx::multisequence_partition(), tlx::multisequence_selection(), block_manager::new_blocks(), AggregateMinMax< Type_ >::operator+(), Aggregate< Type_ >::operator+(), AggregateMinMax< Type_ >::operator+=(), Aggregate< Type_ >::operator+=(), thrill::data::OurNewHandler(), OutputSVG(), examples::select::PickPivots(), examples::suffix_sorting::PrefixDoublingDiscarding(), examples::suffix_sorting::PrefixDoublingSorting(), examples::suffix_sorting::PrefixDoublingWindow(), examples::suffix_sorting::PrefixQuadrupling(), CmdlineParser::print_result(), Context::PrintCollectiveMeanStdev(), block_scheduler_algorithm_offline_lfd< SwappableBlockType >::priority::priority(), ReadBinaryNode< ValueType >::ReadBinaryNode(), RadixHeap< ValueType, KeyExtract, KeyType, Radix >::reorganize_(), hypergeometric_distribution<>::rk_hypergeometric_hrua(), RunJoinPageRankEdgePerLine(), RunPageRankEdgePerLine(), PS5Context< Parameters >::sequential_threshold(), syscall_file::serve(), StatsCounter< ValueType_, true >::set_max(), memory_file::set_size(), Select::SetException(), Select::SetRead(), Select::SetWrite(), ReduceBucketHashTable< TableItem, Key, Value, KeyExtractor, ReduceFunction, Emitter, VolatileKey, ReduceConfig, IndexFunction, KeyEqualFunction >::SpillSmallestPartition(), stats_data::summary< T >::summary(), Connection::SyncRecv(), Connection::SyncSend(), Connection::SyncSendRecv(), HyperLogLogRegisters< p >::toDense(), uint_pair(), and BucketComputation< Radix, ranked_key_type >::upper_bound().

◆ min()

static uint_pair __attribute__::min ( )
static

return an uint_pair instance containing the smallest value possible

Definition at line 217 of file uint_types.hpp.

Referenced by AggregateMinMax< Type_ >::add(), Aggregate< Type_ >::add(), Group::AllGatherBruck(), CollapseNode< ValueType >::consume_counter(), UnionNode< ValueType >::consume_counter(), PS5BigSortStep< Context, StringPtr >::count(), PS5BigSortStep< Context, StringPtr >::distribute(), ZipNode< ValueType, ZipFunction, Pad, UnequalCheck, NoRebalance, kNumInputs >::DoScatter(), ZipWindowNode< ValueType, ZipFunction_, Pad_, UnequalCheck, UseStdArray, kNumInputs_ >::DoScatter(), RebalanceNode< ValueType >::Execute(), SampleNode< ValueType >::Execute(), OverlapWindowNode< ValueType, Input, WindowFunction, PartialWindowFunction >::Execute(), ConcatNode< ValueType >::Execute(), DisjointWindowNode< ValueType, Input, WindowFunction, PartialWindowFunction >::Execute(), block_scheduler< SwappableBlockType >::get_free_internal_block(), ReduceProbingHashTable< TableItem, Key, Value, KeyExtractor, ReduceFunction, Emitter, VolatileKey, ReduceConfig_, IndexFunction, KeyEqualFunction >::GrowPartition(), ReduceProbingHashTable< TableItem, Key, Value, KeyExtractor, ReduceFunction, Emitter, VolatileKey, ReduceConfig_, IndexFunction, KeyEqualFunction >::Initialize(), RadixHeap< ValueType, KeyExtract, KeyType, Radix >::initialize_(), Range::Invalid(), tlx::levenshtein_algorithm(), uint_pair< HighType >::min(), UIntPair< High_ >::min(), PS5SmallsortJob< Context, StringPtr, BktSizeType >::MKQSStep::MKQSStep(), tlx::sort_strings_detail::multikey_quicksort(), tlx::multisequence_partition(), tlx::multisequence_selection(), tlx::multiway_merge_detail::multiway_merge_3_combined(), tlx::multiway_merge_detail::multiway_merge_4_combined(), tlx::multiway_merge_detail::multiway_merge_loser_tree_combined(), tlx::multiway_merge_detail::multiway_merge_loser_tree_unguarded(), ReadBinaryNode< ValueType >::VfsFileBlockSource::NextBlock(), SortNode< ValueType, CompareFunction, SortAlgorithm, Stable >::OnPreOpFile(), ComponentSum< std::vector< Type >, Operation >::operator()(), AggregateMinMax< Type_ >::operator+(), Aggregate< Type_ >::operator+(), AggregateMinMax< Type_ >::operator+=(), Aggregate< Type_ >::operator+=(), OutputSVG(), tlx::parallel_multiway_merge_base(), examples::select::PickPivots(), FlowControlChannel::Predecessor(), tlx::multiway_merge_detail::prepare_unguarded(), Context::PrintCollectiveMeanStdev(), SHA256::process(), ReadBinaryNode< ValueType >::ReadBinaryNode(), SimpleVector< std::thread >::resize(), hypergeometric_distribution<>::rk_hypergeometric_hrua(), hypergeometric_distribution<>::rk_hypergeometric_hyp(), DAryHeap< KeyType, Arity, Compare >::sift_down(), DAryAddressableIntHeap< KeyType, Arity, Compare >::sift_down(), stats_data::summary< T >::summary(), WriteBinaryNode< ValueType >::WriteBinaryNode(), and WriteLinesNode< ValueType >::WriteLinesNode().

◆ operator uint64_t()

__attribute__::operator uint64_t ( ) const

implicit cast to an unsigned long long

Definition at line 134 of file uint_types.hpp.

◆ operator!=()

bool __attribute__::operator!= ( const uint_pair b) const

◆ operator++()

uint_pair& __attribute__::operator++ ( )

prefix increment operator (directly manipulates the integer parts)

Definition at line 146 of file uint_types.hpp.

Referenced by thrill::core::hyperloglog::mergeSameIndices().

◆ operator+=()

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

addition operator (uses 64-bit arithmetic)

Definition at line 166 of file uint_types.hpp.

Referenced by thrill::data::OurNewHandler().

◆ operator--()

uint_pair& __attribute__::operator-- ( )

prefix decrement operator (directly manipulates the integer parts)

Definition at line 156 of file uint_types.hpp.

References uint_pair< HighType >::high.

◆ operator<()

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

less-than comparison operator

Definition at line 187 of file uint_types.hpp.

Referenced by examples::suffix_sorting::operator<<().

◆ operator<<()

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

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

Definition at line 211 of file uint_types.hpp.

◆ operator<=()

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

less-or-equal comparison operator

Definition at line 193 of file uint_types.hpp.

◆ operator==()

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

equality checking operator

Definition at line 175 of file uint_types.hpp.

Referenced by thrill::core::hyperloglog::mergeSameIndices(), and examples::suffix_sorting::operator<<().

◆ operator>()

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

greater comparison operator

Definition at line 199 of file uint_types.hpp.

◆ operator>=()

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

greater-or-equal comparison operator

Definition at line 205 of file uint_types.hpp.

◆ u64()

uint64_t __attribute__::u64 ( ) const

return the number as a uint64_t

Definition at line 140 of file uint_types.hpp.

◆ uint_pair() [1/5]

__attribute__::uint_pair ( )

empty constructor, does not even initialize to zero!

Definition at line 78 of file uint_types.hpp.

References max().

◆ uint_pair() [2/5]

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

construct unit pair from lower and higher parts.

Definition at line 99 of file uint_types.hpp.

◆ uint_pair() [3/5]

__attribute__::uint_pair ( const uint32_t &  a)

implicit conversion from a simple 32-bit unsigned integer

Definition at line 104 of file uint_types.hpp.

◆ uint_pair() [4/5]

__attribute__::uint_pair ( const int32_t &  a)

implicit conversion from a simple 32-bit signed integer

Definition at line 109 of file uint_types.hpp.

◆ uint_pair() [5/5]

__attribute__::uint_pair ( const uint64_t &  a)

implicit conversion from an uint64_t (unsigned long long)

Definition at line 119 of file uint_types.hpp.

◆ ull()

uint64_t __attribute__::ull ( ) const

return the number as an uint64_t (unsigned long long)

Definition at line 128 of file uint_types.hpp.

Referenced by thrill::common::Hash128to64(), and tlx::siphash_plain().

Variable Documentation

◆ __attribute__

class std::numeric_limits< foxxll::uint_pair< HighType > > __attribute__

◆ bytes

◆ digits

const size_t digits = low_bits + high_bits
static

number of binary digits (bits) in uint_pair

Definition at line 72 of file uint_types.hpp.

◆ high

high_type high
private

member containing higher significant integer value

Definition at line 50 of file uint_types.hpp.

◆ high_bits

const size_t high_bits = 8 * sizeof(high_type)
staticprivate

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

Definition at line 68 of file uint_types.hpp.

◆ low

low_type low
private

member containing lower significant integer value

Definition at line 48 of file uint_types.hpp.

◆ low_bits

const size_t low_bits = 8 * sizeof(low_type)
staticprivate

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

Definition at line 59 of file uint_types.hpp.