tlx
IntegerRank< Int > Class Template Reference

Compute the rank of an integer x (i.e. More...

#include <radix_heap.hpp>

Public Types

using int_type = Int
 
using rank_type = typename std::make_unsigned< int_type >::type
 

Static Public Member Functions

static constexpr rank_type rank_of_int (int_type i)
 Maps value i to its rank in int_type. More...
 
static constexpr int_type int_at_rank (rank_type r)
 Returns the r-th smallest number of int_r. More...
 

Static Private Attributes

static constexpr bool use_identity_
 
static constexpr rank_type sign_bit_
 

Detailed Description

template<typename Int>
class tlx::radix_heap_detail::IntegerRank< Int >

Compute the rank of an integer x (i.e.

the number of elements smaller than x that are representable using type Int) and vice versa. If Int is an unsigned integral type, all computations yield identity. If Int is a signed integrals, the smallest (negative) number is mapped to rank zero, the next larger value to one and so on.

The implementation assumes negative numbers are implemented as Two's complement and contains static_asserts failing if this is not the case.

Definition at line 42 of file radix_heap.hpp.

Member Typedef Documentation

using int_type = Int

Definition at line 48 of file radix_heap.hpp.

using rank_type = typename std::make_unsigned<int_type>::type

Definition at line 49 of file radix_heap.hpp.

Member Function Documentation

static constexpr int_type int_at_rank ( rank_type  r)
inlinestatic

Returns the r-th smallest number of int_r.

It is the inverse of rank_of_int, i.e. int_at_rank(rank_of_int(i)) == i for all i.

Definition at line 61 of file radix_heap.hpp.

static constexpr rank_type rank_of_int ( int_type  i)
inlinestatic

Maps value i to its rank in int_type.

For any pair T x < y the invariant IntegerRank<T>::rank_of_int(x) < IntegerRank<T>::rank_of_int(y) holds.

Definition at line 53 of file radix_heap.hpp.

Member Data Documentation

constexpr rank_type sign_bit_
staticprivate

Definition at line 71 of file radix_heap.hpp.

constexpr bool use_identity_
staticprivate

Definition at line 68 of file radix_heap.hpp.


The documentation for this class was generated from the following file: