Crate apint[][src]

Arbitrary precision integers library.

This library mainly features the Arbitrary precision Integer (ApInt) type which is an n-bit integer type acting like a machine integer working in the twos-complement.

This is useful for emulating machine integers for example in constant evaluation of compilers or for solving bitvector formulas of SMT solvers.

Internally ApInt uses small-value optimization for values with a bit-width less than or equal to 64 bits. It uses 64 bit digits and thus its algorithms computes within the base of 264.

The ApInt data structure does not know signedness. Instead, the operations defined on it (methods) do so. This makes it the perfect building block for higher-level primitives later on.

The crate was designed for correctness of emulation and performance in mind and the interface of ApInt is very comprehensive.

Modules

prelude

Re-exports some commonly used items of this crate.

Structs

ApInt

An arbitrary precision integer with modulo arithmetics similar to machine integers.

BitPos

Represents a bit position within an ApInt.

BitWidth

The BitWidth represents the length of an ApInt.

Error

Represents an error that may occure upon using the ApInt library.

Int

Signed machine integer with arbitrary bitwidths and modulo arithmetics.

Radix

A radix for parsing strings as ApInts.

ShiftAmount

Represents an amount of bits to shift an ApInt.

UInt

Unsigned machine integer with arbitrary bitwidths and modulo arithmetics.

Enums

Bit

Represents the set or unset state of a bit within an ApInt.

ErrorKind

Represents the kind of an Error.

Traits

Width

Types that have an associated bit width may implement Width.

Type Definitions

Result

The Result type used in ApInt.