dune-common 3.0-git
Public Types | Public Member Functions | List of all members
Dune::bigunsignedint< k > Class Template Reference

Portable very large unsigned integers. More...

#include <dune/common/bigunsignedint.hh>

Public Types

enum  {
  bits =std::numeric_limits<std::uint16_t>::digits , n =k/bits+(kbits!=0) , hexdigits =4 , bitmask =0xFFFF ,
  compbitmask =0xFFFF0000 , overflowmask =0x1
}
 

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) const
 subtract
 
bigunsignedint< k > operator* (const bigunsignedint< k > &x) const
 multiply
 
bigunsignedint< k > & operator++ ()
 prefix increment
 
bigunsignedint< k > operator/ (const bigunsignedint< k > &x) const
 
bigunsignedint< k > operator% (const bigunsignedint< k > &x) const
 
bigunsignedint< k > operator& (const bigunsignedint< k > &x) const
 bitwise and
 
bigunsignedint< k > operator^ (const bigunsignedint< k > &x) const
 bitwise exor
 
bigunsignedint< k > operator| (const bigunsignedint< k > &x) const
 bitwise or
 
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.
 

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 Enumeration Documentation

◆ anonymous enum

template<int k>
anonymous enum
Enumerator
bits 
hexdigits 
bitmask 
compbitmask 
overflowmask 

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