ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
arith_tools.h File Reference
#include <util/irep/expr.h>
#include <irep2/irep2.h>
#include <util/arith/mp_arith.h>
Include dependency graph for arith_tools.h:

Go to the source code of this file.

Functions

bool to_integer (const exprt &expr, BigInt &int_value)
bool to_integer (const expr2tc &expr, BigInt &int_value)
 IREP2 twin of to_integer(const exprt&): fold expr to an integer value, returning false on success (value written to int_value) and true on failure (not a foldable integer constant).
exprt from_integer (const BigInt &int_value, const typet &type)
expr2tc from_integer (const BigInt &int_value, const type2tc &type)
exprt from_double (double val, const typet &type)
BigInt power (const BigInt &base, const BigInt &exponent)
BigInt address_bits (const BigInt &size)
 ceil(log2(size))

Function Documentation

◆ address_bits()

BigInt address_bits ( const BigInt & size)

ceil(log2(size))

◆ from_double()

exprt from_double ( double val,
const typet & type )

◆ from_integer() [1/2]

expr2tc from_integer ( const BigInt & int_value,
const type2tc & type )

◆ from_integer() [2/2]

exprt from_integer ( const BigInt & int_value,
const typet & type )

◆ power()

BigInt power ( const BigInt & base,
const BigInt & exponent )

◆ to_integer() [1/2]

bool to_integer ( const expr2tc & expr,
BigInt & int_value )

IREP2 twin of to_integer(const exprt&): fold expr to an integer value, returning false on success (value written to int_value) and true on failure (not a foldable integer constant).

Mirrors the legacy contract. A constant_int / constant_bool yields its value directly; a typecast of a constant is folded through the simplifier so the cast (truncation, sign change, bool conversion) is applied — never extract the operand's raw value across a cast. Callers that have already simplified expr hit only the bare-constant paths.

◆ to_integer() [2/2]

bool to_integer ( const exprt & expr,
BigInt & int_value )