cprover
mp_arith.h File Reference
#include <iosfwd>
#include <string>
#include "big-int/bigint.hh"
+ Include dependency graph for mp_arith.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef BigInt mp_integer
 

Functions

std::ostream & operator<< (std::ostream &, const mp_integer &)
 
mp_integer operator>> (const mp_integer &, const mp_integer &)
 
mp_integer operator<< (const mp_integer &, const mp_integer &)
 
mp_integer bitwise_or (const mp_integer &, const mp_integer &)
 bitwise 'or' of two nonnegative integers More...
 
mp_integer bitwise_and (const mp_integer &, const mp_integer &)
 bitwise 'and' of two nonnegative integers More...
 
mp_integer bitwise_xor (const mp_integer &, const mp_integer &)
 bitwise 'xor' of two nonnegative integers More...
 
mp_integer arith_left_shift (const mp_integer &, const mp_integer &, std::size_t true_size)
 arithmetic left shift bitwise operations only make sense on native objects, hence the largest object size should be the largest available c++ integer size (currently long long) More...
 
mp_integer arith_right_shift (const mp_integer &, const mp_integer &, std::size_t true_size)
 arithmetic right shift (loads sign on MSB) bitwise operations only make sense on native objects, hence the largest object size should be the largest available c++ integer size (currently long long) More...
 
mp_integer logic_left_shift (const mp_integer &, const mp_integer &, std::size_t true_size)
 logic left shift bitwise operations only make sense on native objects, hence the largest object size should be the largest available c++ integer size (currently long long) More...
 
mp_integer logic_right_shift (const mp_integer &, const mp_integer &, std::size_t true_size)
 logic right shift (loads 0 on MSB) bitwise operations only make sense on native objects, hence the largest object size should be the largest available c++ integer size (currently long long) More...
 
mp_integer rotate_right (const mp_integer &, const mp_integer &, std::size_t true_size)
 rotates right (MSB=LSB) bitwise operations only make sense on native objects, hence the largest object size should be the largest available c++ integer size (currently long long) More...
 
mp_integer rotate_left (const mp_integer &, const mp_integer &, std::size_t true_size)
 rotate left (LSB=MSB) bitwise operations only make sense on native objects, hence the largest object size should be the largest available c++ integer size (currently long long) More...
 
const std::string integer2string (const mp_integer &, unsigned base=10)
 
const mp_integer string2integer (const std::string &, unsigned base=10)
 
const std::string integer2binary (const mp_integer &, std::size_t width)
 
const mp_integer binary2integer (const std::string &, bool is_signed)
 convert binary string representation to mp_integer More...
 

Typedef Documentation

◆ mp_integer

typedef BigInt mp_integer

Definition at line 19 of file mp_arith.h.

Function Documentation

◆ arith_left_shift()

mp_integer arith_left_shift ( const mp_integer ,
const mp_integer ,
std::size_t  true_size 
)

arithmetic left shift bitwise operations only make sense on native objects, hence the largest object size should be the largest available c++ integer size (currently long long)

Definition at line 256 of file mp_arith.cpp.

◆ arith_right_shift()

mp_integer arith_right_shift ( const mp_integer ,
const mp_integer ,
std::size_t  true_size 
)

arithmetic right shift (loads sign on MSB) bitwise operations only make sense on native objects, hence the largest object size should be the largest available c++ integer size (currently long long)

Definition at line 277 of file mp_arith.cpp.

◆ binary2integer()

const mp_integer binary2integer ( const std::string &  n,
bool  is_signed 
)

convert binary string representation to mp_integer

parameters: string of '0'/'1', most significant bit first
Returns
mp_integer

Definition at line 120 of file mp_arith.cpp.

◆ bitwise_and()

mp_integer bitwise_and ( const mp_integer ,
const mp_integer  
)

bitwise 'and' of two nonnegative integers

Definition at line 230 of file mp_arith.cpp.

◆ bitwise_or()

mp_integer bitwise_or ( const mp_integer ,
const mp_integer  
)

bitwise 'or' of two nonnegative integers

Definition at line 218 of file mp_arith.cpp.

◆ bitwise_xor()

mp_integer bitwise_xor ( const mp_integer ,
const mp_integer  
)

bitwise 'xor' of two nonnegative integers

Definition at line 242 of file mp_arith.cpp.

◆ integer2binary()

const std::string integer2binary ( const mp_integer n,
std::size_t  width 
)
Returns
string of '0'/'1', most significant bit first

Definition at line 67 of file mp_arith.cpp.

◆ integer2string()

const std::string integer2string ( const mp_integer ,
unsigned  base = 10 
)

Definition at line 106 of file mp_arith.cpp.

◆ logic_left_shift()

mp_integer logic_left_shift ( const mp_integer ,
const mp_integer ,
std::size_t  true_size 
)

logic left shift bitwise operations only make sense on native objects, hence the largest object size should be the largest available c++ integer size (currently long long)

Definition at line 296 of file mp_arith.cpp.

◆ logic_right_shift()

mp_integer logic_right_shift ( const mp_integer ,
const mp_integer ,
std::size_t  true_size 
)

logic right shift (loads 0 on MSB) bitwise operations only make sense on native objects, hence the largest object size should be the largest available c++ integer size (currently long long)

Definition at line 322 of file mp_arith.cpp.

◆ operator<<() [1/2]

mp_integer operator<< ( const mp_integer ,
const mp_integer  
)

Definition at line 43 of file mp_arith.cpp.

◆ operator<<() [2/2]

std::ostream& operator<< ( std::ostream &  ,
const mp_integer  
)

Definition at line 48 of file mp_arith.cpp.

◆ operator>>()

mp_integer operator>> ( const mp_integer ,
const mp_integer  
)

Definition at line 25 of file mp_arith.cpp.

◆ rotate_left()

mp_integer rotate_left ( const mp_integer ,
const mp_integer ,
std::size_t  true_size 
)

rotate left (LSB=MSB) bitwise operations only make sense on native objects, hence the largest object size should be the largest available c++ integer size (currently long long)

Definition at line 358 of file mp_arith.cpp.

◆ rotate_right()

mp_integer rotate_right ( const mp_integer ,
const mp_integer ,
std::size_t  true_size 
)

rotates right (MSB=LSB) bitwise operations only make sense on native objects, hence the largest object size should be the largest available c++ integer size (currently long long)

Definition at line 338 of file mp_arith.cpp.

◆ string2integer()

const mp_integer string2integer ( const std::string &  n,
unsigned  base 
)
parameters: string of '0'-'9' etc. most significant digit first
base of number representation
Returns
mp_integer

Definition at line 57 of file mp_arith.cpp.