Loading...
Searching...
No Matches
Dune::bigunsignedint< k > Class Template Reference
Common » Numbers

Portable very large unsigned integers. More...

`#include <dune/common/bigunsignedint.hh>`

## Public Member Functions

| bigunsignedint ()
| Construct uninitialized.
template<typename Signed>
| bigunsignedint (Signed x, typename std::enable_if< std::is_integral< Signed >::value &&std::is_signed< Signed >::value >::type *=0)
| Construct from signed int.
| bigunsignedint (std::uintmax_t x)
| Construct from unsigned int.
void | print (std::ostream &s) const
| Print number in hex notation.
bigunsignedint< k > | operator+ (const bigunsignedint< k > &x) const
| add
bigunsignedint< k > & | operator+= (const bigunsignedint< k > &x)
bigunsignedint< k > | operator- (const bigunsignedint< k > &x) const
| subtract
bigunsignedint< k > & | operator-= (const bigunsignedint< k > &x)
bigunsignedint< k > | operator* (const bigunsignedint< k > &x) const
| multiply
bigunsignedint< k > & | operator*= (const bigunsignedint< k > &x)
bigunsignedint< k > & | operator++ ()
| prefix increment
bigunsignedint< k > | operator/ (const bigunsignedint< k > &x) const
bigunsignedint< k > & | operator/= (const bigunsignedint< k > &x)
bigunsignedint< k > | operator% (const bigunsignedint< k > &x) const
bigunsignedint< k > & | operator%= (const bigunsignedint< k > &x)
bigunsignedint< k > | operator& (const bigunsignedint< k > &x) const
| bitwise and
bigunsignedint< k > & | operator&= (const bigunsignedint< k > &x)
bigunsignedint< k > | operator^ (const bigunsignedint< k > &x) const
| bitwise exor
bigunsignedint< k > & | operator^= (const bigunsignedint< k > &x)
bigunsignedint< k > | operator| (const bigunsignedint< k > &x) const
| bitwise or
bigunsignedint< k > & | operator|= (const bigunsignedint< k > &x)
bigunsignedint< k > | operator~ () const
| bitwise complement
bigunsignedint< k > | operator<< (int i) const
| left shift
bigunsignedint< k > | operator>> (int i) const
| right shift
bool | operator< (const bigunsignedint< k > &x) const
| less than
bool | operator<= (const bigunsignedint< k > &x) const
| less than or equal
bool | operator> (const bigunsignedint< k > &x) const
| greater than
bool | operator>= (const bigunsignedint< k > &x) const
| greater or equal
bool | operator== (const bigunsignedint< k > &x) const
| equal
bool | operator!= (const bigunsignedint< k > &x) const
| not equal
std::uint_least32_t | touint () const
| export to other types
double | todouble () const
| Convert to a double.

## Static Public Attributes

static constexpr int | bits = std::numeric_limits<std::uint16_t>::digits
static constexpr int | n = k/bits+(k%bits!=0)
static constexpr int | hexdigits = 4
static constexpr int | bitmask = 0xFFFF
static constexpr int | compbitmask = 0xFFFF0000
static constexpr int | overflowmask = 0x1

## Friends

class | bigunsignedint< k/2 >
struct | MPITraits< bigunsignedint< k > >
int | bit_width (const bigunsignedint &arg)
| Bit width.
int | countl_zero (const bigunsignedint &arg)
| Count left zero bits.
std::size_t | hash_value (const bigunsignedint &arg)

## Detailed Description

template<int k>
class Dune::bigunsignedint< k >

Portable very large unsigned integers.

Implements (arbitrarily) large unsigned integers to be used as global ids in some grid managers. Size is a template parameter.

Template Parameters

  k | Number of bits of the integer type

## Member Function Documentation

## operator%()

template<int k>

bigunsignedint< k > Dune::bigunsignedint< k >::operator% | ( | const bigunsignedint< k > & | x | ) | const

modulo

Warning
  This function is very slow and its usage should be prevented if possible

## operator&()

template<int k>

bigunsignedint< k > Dune::bigunsignedint< k >::operator& | ( | const bigunsignedint< k > & | x | ) | const

bitwise and

## operator*()

template<int k>

bigunsignedint< k > Dune::bigunsignedint< k >::operator* | ( | const bigunsignedint< k > & | x | ) | const

multiply

## operator+()

template<int k>

bigunsignedint< k > Dune::bigunsignedint< k >::operator+ | ( | const bigunsignedint< k > & | x | ) | const

add

## operator-()

template<int k>

bigunsignedint< k > Dune::bigunsignedint< k >::operator- | ( | const bigunsignedint< k > & | x | ) | const

subtract

## operator/()

template<int k>

bigunsignedint< k > Dune::bigunsignedint< k >::operator/ | ( | const bigunsignedint< k > & | x | ) | const

divide

Warning
  This function is very slow and its usage should be prevented if possible

## operator^()

template<int k>

bigunsignedint< k > Dune::bigunsignedint< k >::operator^ | ( | const bigunsignedint< k > & | x | ) | const

bitwise exor

## operator|()

template<int k>

bigunsignedint< k > Dune::bigunsignedint< k >::operator| | ( | const bigunsignedint< k > & | x | ) | const

bitwise or

## Friends And Related Symbol Documentation

## bigunsignedint< k/2 >

template<int k>

friend class bigunsignedint< k/2 >

friend

## bit_width

template<int k>

int bit_width | ( | const bigunsignedint< k > & | arg | ) |

friend

Bit width.

If x is not zero, calculates the number of bits needed to store the value arg

## countl_zero

template<int k>

int countl_zero | ( | const bigunsignedint< k > & | arg | ) |

friend

Count left zero bits.

The number of consecutive ​0​ bits in the value of arg, starting from the most significant bit

## hash_value

template<int k>

std::size_t hash_value | ( | const bigunsignedint< k > & | arg | ) |

friend

## MPITraits< bigunsignedint< k > >

template<int k>

friend struct MPITraits< bigunsignedint< k > >

friend

## Member Data Documentation

## bitmask

template<int k>

int Dune::bigunsignedint< k >::bitmask = 0xFFFF

static constexpr

## bits

template<int k>

int Dune::bigunsignedint< k >::bits = std::numeric_limits<std::uint16_t>::digits

static constexpr

## compbitmask

template<int k>

int Dune::bigunsignedint< k >::compbitmask = 0xFFFF0000

static constexpr

## hexdigits

template<int k>

int Dune::bigunsignedint< k >::hexdigits = 4

static constexpr

## n

template<int k>

int Dune::bigunsignedint< k >::n = k/bits+(k%bits!=0)

static constexpr

## overflowmask

template<int k>

int Dune::bigunsignedint< k >::overflowmask = 0x1

static constexpr

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

- bigunsignedint.hh