dune-common  2.9.0
Public Member Functions | Static Public Attributes | List of all members
Dune::bigunsignedint< k > Class Template Reference

Portable very large unsigned integers. More...

#include <dune/common/bigunsignedint.hh>

Public Member Functions

 bigunsignedint ()
 Construct uninitialized. More...
 
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. More...
 
 bigunsignedint (std::uintmax_t x)
 Construct from unsigned int. More...
 
void print (std::ostream &s) const
 Print number in hex notation. More...
 
bigunsignedint< k > operator+ (const bigunsignedint< k > &x) const
 add More...
 
bigunsignedint< k > & operator+= (const bigunsignedint< k > &x)
 
bigunsignedint< k > operator- (const bigunsignedint< k > &x) const
 subtract More...
 
bigunsignedint< k > & operator-= (const bigunsignedint< k > &x)
 
bigunsignedint< k > operator* (const bigunsignedint< k > &x) const
 multiply More...
 
bigunsignedint< k > & operator*= (const bigunsignedint< k > &x)
 
bigunsignedint< k > & operator++ ()
 prefix increment More...
 
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 More...
 
bigunsignedint< k > & operator&= (const bigunsignedint< k > &x)
 
bigunsignedint< k > operator^ (const bigunsignedint< k > &x) const
 bitwise exor More...
 
bigunsignedint< k > & operator^= (const bigunsignedint< k > &x)
 
bigunsignedint< k > operator| (const bigunsignedint< k > &x) const
 bitwise or More...
 
bigunsignedint< k > & operator|= (const bigunsignedint< k > &x)
 
bigunsignedint< k > operator~ () const
 bitwise complement More...
 
bigunsignedint< k > operator<< (int i) const
 left shift More...
 
bigunsignedint< k > operator>> (int i) const
 right shift More...
 
bool operator< (const bigunsignedint< k > &x) const
 less than More...
 
bool operator<= (const bigunsignedint< k > &x) const
 less than or equal More...
 
bool operator> (const bigunsignedint< k > &x) const
 greater than More...
 
bool operator>= (const bigunsignedint< k > &x) const
 greater or equal More...
 
bool operator== (const bigunsignedint< k > &x) const
 equal More...
 
bool operator!= (const bigunsignedint< k > &x) const
 not equal More...
 
std::uint_least32_t touint () const
 export to other types More...
 
double todouble () const
 Convert to a double. More...
 

Static Public Attributes

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

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
kNumber 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

Member Data Documentation

◆ bitmask

template<int k>
constexpr static int Dune::bigunsignedint< k >::bitmask = 0xFFFF
staticconstexpr

◆ bits

template<int k>
constexpr static int Dune::bigunsignedint< k >::bits = std::numeric_limits<std::uint16_t>::digits
staticconstexpr

◆ compbitmask

template<int k>
constexpr static int Dune::bigunsignedint< k >::compbitmask = 0xFFFF0000
staticconstexpr

◆ hexdigits

template<int k>
constexpr static int Dune::bigunsignedint< k >::hexdigits = 4
staticconstexpr

◆ n

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

◆ overflowmask

template<int k>
constexpr static int Dune::bigunsignedint< k >::overflowmask = 0x1
staticconstexpr

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