CBMC
|
#include "mp_arith.h"
#include <algorithm>
#include <cctype>
#include <climits>
#include <vector>
#include "arith_tools.h"
#include "invariant.h"
Go to the source code of this file.
Typedefs | |
typedef BigInt::ullong_t | ullong_t |
typedef BigInt::llong_t | llong_t |
Functions | |
mp_integer | operator>> (const mp_integer &a, const mp_integer &b) |
mp_integer | operator<< (const mp_integer &a, const mp_integer &b) |
std::ostream & | operator<< (std::ostream &out, const mp_integer &n) |
const mp_integer | string2integer (const std::string &n, unsigned base) |
const std::string | integer2binary (const mp_integer &n, std::size_t width) |
const std::string | integer2string (const mp_integer &n, unsigned base) |
const mp_integer | binary2integer (const std::string &n, bool is_signed) |
convert binary string representation to mp_integer More... | |
mp_integer | bitwise (const mp_integer &a, const mp_integer &b, std::function< bool(bool, bool)> f) |
bitwise binary operation over two integers, given as a functor More... | |
mp_integer | bitwise_or (const mp_integer &a, const mp_integer &b) |
bitwise 'or' of two nonnegative integers More... | |
mp_integer | bitwise_and (const mp_integer &a, const mp_integer &b) |
bitwise 'and' of two nonnegative integers More... | |
mp_integer | bitwise_xor (const mp_integer &a, const mp_integer &b) |
bitwise 'xor' of two nonnegative integers More... | |
mp_integer | arith_left_shift (const mp_integer &a, const mp_integer &b, 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 &a, const mp_integer &b, 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 &a, const mp_integer &b, 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 &a, const mp_integer &b, 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 &a, const mp_integer &b, 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 &a, const mp_integer &b, 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... | |
typedef BigInt::llong_t llong_t |
Definition at line 20 of file mp_arith.cpp.
typedef BigInt::ullong_t ullong_t |
Definition at line 19 of file mp_arith.cpp.
mp_integer arith_left_shift | ( | const mp_integer & | a, |
const mp_integer & | b, | ||
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 253 of file mp_arith.cpp.
mp_integer arith_right_shift | ( | const mp_integer & | a, |
const mp_integer & | b, | ||
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 272 of file mp_arith.cpp.
const mp_integer binary2integer | ( | const std::string & | n, |
bool | is_signed | ||
) |
convert binary string representation to mp_integer
Definition at line 117 of file mp_arith.cpp.
mp_integer bitwise | ( | const mp_integer & | a, |
const mp_integer & | b, | ||
std::function< bool(bool, bool)> | f | ||
) |
bitwise binary operation over two integers, given as a functor
a | the first integer |
b | the second integer |
f | the function over two bits |
Definition at line 190 of file mp_arith.cpp.
mp_integer bitwise_and | ( | const mp_integer & | a, |
const mp_integer & | b | ||
) |
bitwise 'and' of two nonnegative integers
Definition at line 227 of file mp_arith.cpp.
mp_integer bitwise_or | ( | const mp_integer & | a, |
const mp_integer & | b | ||
) |
bitwise 'or' of two nonnegative integers
Definition at line 215 of file mp_arith.cpp.
mp_integer bitwise_xor | ( | const mp_integer & | a, |
const mp_integer & | b | ||
) |
bitwise 'xor' of two nonnegative integers
Definition at line 239 of file mp_arith.cpp.
const std::string integer2binary | ( | const mp_integer & | n, |
std::size_t | width | ||
) |
Definition at line 64 of file mp_arith.cpp.
const std::string integer2string | ( | const mp_integer & | n, |
unsigned | base | ||
) |
Definition at line 103 of file mp_arith.cpp.
mp_integer logic_left_shift | ( | const mp_integer & | a, |
const mp_integer & | b, | ||
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 291 of file mp_arith.cpp.
mp_integer logic_right_shift | ( | const mp_integer & | a, |
const mp_integer & | b, | ||
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 317 of file mp_arith.cpp.
mp_integer operator<< | ( | const mp_integer & | a, |
const mp_integer & | b | ||
) |
Definition at line 40 of file mp_arith.cpp.
std::ostream& operator<< | ( | std::ostream & | out, |
const mp_integer & | n | ||
) |
Definition at line 45 of file mp_arith.cpp.
mp_integer operator>> | ( | const mp_integer & | a, |
const mp_integer & | b | ||
) |
Definition at line 22 of file mp_arith.cpp.
mp_integer rotate_left | ( | const mp_integer & | a, |
const mp_integer & | b, | ||
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 353 of file mp_arith.cpp.
mp_integer rotate_right | ( | const mp_integer & | a, |
const mp_integer & | b, | ||
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 333 of file mp_arith.cpp.
const mp_integer string2integer | ( | const std::string & | n, |
unsigned | base | ||
) |
Definition at line 54 of file mp_arith.cpp.