ExRandom  3.0
exrandom::digit_arithmetic< b > Class Template Reference

Machinery to manipulate bases. More...

#include <exrandom/digit_arithmetic.hpp>

Static Public Attributes

static const uint_t base
 
static const uint_t basem1
 
static const int bits
 
static const bool power_of_two
 

Related Functions

(Note that these are not member functions.)

typedef std::uint_fast32_t uint_t
 
const int uint_w
 
const uint_t uint_m
 
constexpr int highest_bit_idx (unsigned x)
 

Detailed Description

template<uint_t b>
class exrandom::digit_arithmetic< b >

Machinery to manipulate bases.

Template Parameters
bthe base as an unsigned.

Base b = 0 is treated as 232. b = 1 is disallowed.

Definition at line 62 of file digit_arithmetic.hpp.

Friends And Related Function Documentation

◆ uint_t

template<uint_t b>
typedef std::uint_fast32_t uint_t
related

The unsigned type used for random digits.

Definition at line 31 of file digit_arithmetic.hpp.

◆ uint_w

template<uint_t b>
const int uint_w
related

The size of uint_t in bits.

Definition at line 37 of file digit_arithmetic.hpp.

◆ uint_m

template<uint_t b>
const uint_t uint_m
related

A mask for uint_t.

Definition at line 43 of file digit_arithmetic.hpp.

◆ highest_bit_idx()

template<uint_t b>
constexpr int highest_bit_idx ( unsigned  x)
related
Parameters
x
Returns
the position of the most significant bit in x.

returns 0 for x = 0, 32 for x = uint_m

Definition at line 52 of file digit_arithmetic.hpp.

Member Data Documentation

◆ base

template<uint_t b>
const uint_t exrandom::digit_arithmetic< b >::base
static

The base (or 0 if the base is 232).

Definition at line 67 of file digit_arithmetic.hpp.

◆ basem1

template<uint_t b>
const uint_t exrandom::digit_arithmetic< b >::basem1
static

The base less 1, in range [1, 232 − 1].

Definition at line 71 of file digit_arithmetic.hpp.

◆ bits

template<uint_t b>
const int exrandom::digit_arithmetic< b >::bits
static

The number of bits needed to hold a digit in [0, basem1].

Definition at line 75 of file digit_arithmetic.hpp.

◆ power_of_two

template<uint_t b>
const bool exrandom::digit_arithmetic< b >::power_of_two
static

Is the base a power of 2?

Definition at line 80 of file digit_arithmetic.hpp.


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