LLVM 22.0.0git
llvm::detail::SlowDynamicAPInt Class Reference

A simple class providing dynamic arbitrary-precision arithmetic. More...

#include "llvm/ADT/SlowDynamicAPInt.h"

Public Member Functions

LLVM_ABI SlowDynamicAPInt (int64_t Val)
LLVM_ABI SlowDynamicAPInt ()
LLVM_ABI SlowDynamicAPInt (const APInt &Val)
LLVM_ABI SlowDynamicAPIntoperator= (int64_t Val)
LLVM_ABI operator int64_t () const
LLVM_ABI SlowDynamicAPInt operator- () const
LLVM_ABI bool operator== (const SlowDynamicAPInt &O) const
LLVM_ABI bool operator!= (const SlowDynamicAPInt &O) const
LLVM_ABI bool operator> (const SlowDynamicAPInt &O) const
LLVM_ABI bool operator< (const SlowDynamicAPInt &O) const
LLVM_ABI bool operator<= (const SlowDynamicAPInt &O) const
LLVM_ABI bool operator>= (const SlowDynamicAPInt &O) const
LLVM_ABI SlowDynamicAPInt operator+ (const SlowDynamicAPInt &O) const
LLVM_ABI SlowDynamicAPInt operator- (const SlowDynamicAPInt &O) const
LLVM_ABI SlowDynamicAPInt operator* (const SlowDynamicAPInt &O) const
LLVM_ABI SlowDynamicAPInt operator/ (const SlowDynamicAPInt &O) const
LLVM_ABI SlowDynamicAPInt operator% (const SlowDynamicAPInt &O) const
 This operation cannot overflow.
LLVM_ABI SlowDynamicAPIntoperator+= (const SlowDynamicAPInt &O)
LLVM_ABI SlowDynamicAPIntoperator-= (const SlowDynamicAPInt &O)
LLVM_ABI SlowDynamicAPIntoperator*= (const SlowDynamicAPInt &O)
LLVM_ABI SlowDynamicAPIntoperator/= (const SlowDynamicAPInt &O)
LLVM_ABI SlowDynamicAPIntoperator%= (const SlowDynamicAPInt &O)
LLVM_ABI SlowDynamicAPIntoperator++ ()
LLVM_ABI SlowDynamicAPIntoperator-- ()
unsigned getBitWidth () const
LLVM_ABI void print (raw_ostream &OS) const
LLVM_DUMP_METHOD void dump () const

Public Attributes

friend DynamicAPInt

Friends

LLVM_ABI friend SlowDynamicAPInt abs (const SlowDynamicAPInt &X)
 Redeclarations of friend declarations above to make it discoverable by lookups.
LLVM_ABI friend SlowDynamicAPInt ceilDiv (const SlowDynamicAPInt &LHS, const SlowDynamicAPInt &RHS)
LLVM_ABI friend SlowDynamicAPInt floorDiv (const SlowDynamicAPInt &LHS, const SlowDynamicAPInt &RHS)
LLVM_ABI friend SlowDynamicAPInt gcd (const SlowDynamicAPInt &A, const SlowDynamicAPInt &B)
 The operands must be non-negative for gcd.
LLVM_ABI friend hash_code hash_value (const SlowDynamicAPInt &X)
 Overload to compute a hash_code for a SlowDynamicAPInt value.

Detailed Description

A simple class providing dynamic arbitrary-precision arithmetic.

Internally, it stores an APInt, whose width is doubled whenever an overflow occurs at a certain width. The default constructor sets the initial width to 64. SlowDynamicAPInt is primarily intended to be used as a slow fallback path for the upcoming DynamicAPInt class.

Definition at line 35 of file SlowDynamicAPInt.h.

Constructor & Destructor Documentation

◆ SlowDynamicAPInt() [1/3]

◆ SlowDynamicAPInt() [2/3]

SlowDynamicAPInt::SlowDynamicAPInt ( )

◆ SlowDynamicAPInt() [3/3]

SlowDynamicAPInt::SlowDynamicAPInt ( const APInt & Val)
explicit

Definition at line 20 of file SlowDynamicAPInt.cpp.

Member Function Documentation

◆ dump()

LLVM_DUMP_METHOD void SlowDynamicAPInt::dump ( ) const

Definition at line 287 of file SlowDynamicAPInt.cpp.

References llvm::dbgs(), LLVM_DUMP_METHOD, and print().

◆ getBitWidth()

unsigned llvm::detail::SlowDynamicAPInt::getBitWidth ( ) const
inline

Definition at line 80 of file SlowDynamicAPInt.h.

◆ operator int64_t()

SlowDynamicAPInt::operator int64_t ( ) const
explicit

Definition at line 24 of file SlowDynamicAPInt.cpp.

◆ operator!=()

bool SlowDynamicAPInt::operator!= ( const SlowDynamicAPInt & O) const

Definition at line 130 of file SlowDynamicAPInt.cpp.

References getMaxWidth(), and SlowDynamicAPInt().

◆ operator%()

SlowDynamicAPInt SlowDynamicAPInt::operator% ( const SlowDynamicAPInt & O) const

This operation cannot overflow.

Definition at line 234 of file SlowDynamicAPInt.cpp.

References SlowDynamicAPInt(), and SlowDynamicAPInt().

◆ operator%=()

SlowDynamicAPInt & SlowDynamicAPInt::operator%= ( const SlowDynamicAPInt & O)

Definition at line 267 of file SlowDynamicAPInt.cpp.

References SlowDynamicAPInt().

◆ operator*()

SlowDynamicAPInt SlowDynamicAPInt::operator* ( const SlowDynamicAPInt & O) const

◆ operator*=()

SlowDynamicAPInt & SlowDynamicAPInt::operator*= ( const SlowDynamicAPInt & O)

Definition at line 259 of file SlowDynamicAPInt.cpp.

References SlowDynamicAPInt().

◆ operator+()

SlowDynamicAPInt SlowDynamicAPInt::operator+ ( const SlowDynamicAPInt & O) const

◆ operator++()

SlowDynamicAPInt & SlowDynamicAPInt::operator++ ( )

Definition at line 271 of file SlowDynamicAPInt.cpp.

References SlowDynamicAPInt().

◆ operator+=()

SlowDynamicAPInt & SlowDynamicAPInt::operator+= ( const SlowDynamicAPInt & O)

Assignment operators, preincrement, predecrement.

Definition at line 251 of file SlowDynamicAPInt.cpp.

References SlowDynamicAPInt().

◆ operator-() [1/2]

SlowDynamicAPInt SlowDynamicAPInt::operator- ( ) const

Overflow only occurs when the value is the minimum possible value.

Definition at line 239 of file SlowDynamicAPInt.cpp.

References SlowDynamicAPInt(), and SlowDynamicAPInt().

◆ operator-() [2/2]

SlowDynamicAPInt SlowDynamicAPInt::operator- ( const SlowDynamicAPInt & O) const

◆ operator--()

SlowDynamicAPInt & SlowDynamicAPInt::operator-- ( )

Definition at line 276 of file SlowDynamicAPInt.cpp.

References SlowDynamicAPInt().

◆ operator-=()

SlowDynamicAPInt & SlowDynamicAPInt::operator-= ( const SlowDynamicAPInt & O)

Definition at line 255 of file SlowDynamicAPInt.cpp.

References SlowDynamicAPInt().

◆ operator/()

SlowDynamicAPInt SlowDynamicAPInt::operator/ ( const SlowDynamicAPInt & O) const

◆ operator/=()

SlowDynamicAPInt & SlowDynamicAPInt::operator/= ( const SlowDynamicAPInt & O)

Definition at line 263 of file SlowDynamicAPInt.cpp.

References SlowDynamicAPInt().

◆ operator<()

bool SlowDynamicAPInt::operator< ( const SlowDynamicAPInt & O) const

Definition at line 138 of file SlowDynamicAPInt.cpp.

References getMaxWidth(), and SlowDynamicAPInt().

◆ operator<=()

bool SlowDynamicAPInt::operator<= ( const SlowDynamicAPInt & O) const

Definition at line 142 of file SlowDynamicAPInt.cpp.

References getMaxWidth(), and SlowDynamicAPInt().

◆ operator=()

SlowDynamicAPInt & SlowDynamicAPInt::operator= ( int64_t Val)

Definition at line 21 of file SlowDynamicAPInt.cpp.

References SlowDynamicAPInt(), and SlowDynamicAPInt().

◆ operator==()

bool SlowDynamicAPInt::operator== ( const SlowDynamicAPInt & O) const

Comparison operators.

Definition at line 126 of file SlowDynamicAPInt.cpp.

References getMaxWidth(), and SlowDynamicAPInt().

◆ operator>()

bool SlowDynamicAPInt::operator> ( const SlowDynamicAPInt & O) const

Definition at line 134 of file SlowDynamicAPInt.cpp.

References getMaxWidth(), and SlowDynamicAPInt().

◆ operator>=()

bool SlowDynamicAPInt::operator>= ( const SlowDynamicAPInt & O) const

Definition at line 146 of file SlowDynamicAPInt.cpp.

References getMaxWidth(), and SlowDynamicAPInt().

◆ print()

void SlowDynamicAPInt::print ( raw_ostream & OS) const

Printing.

Definition at line 284 of file SlowDynamicAPInt.cpp.

Referenced by dump().

◆ abs

LLVM_ABI friend SlowDynamicAPInt abs ( const SlowDynamicAPInt & X)
friend

Redeclarations of friend declarations above to make it discoverable by lookups.

References LLVM_ABI, SlowDynamicAPInt(), and X.

◆ ceilDiv

LLVM_ABI friend SlowDynamicAPInt ceilDiv ( const SlowDynamicAPInt & LHS,
const SlowDynamicAPInt & RHS )
friend

References LHS, LLVM_ABI, RHS, and SlowDynamicAPInt().

◆ floorDiv

LLVM_ABI friend SlowDynamicAPInt floorDiv ( const SlowDynamicAPInt & LHS,
const SlowDynamicAPInt & RHS )
friend

References LHS, LLVM_ABI, RHS, and SlowDynamicAPInt().

◆ gcd

The operands must be non-negative for gcd.

References A(), B(), LLVM_ABI, and SlowDynamicAPInt().

◆ hash_value

LLVM_ABI friend hash_code hash_value ( const SlowDynamicAPInt & X)
friend

Overload to compute a hash_code for a SlowDynamicAPInt value.

References LLVM_ABI, SlowDynamicAPInt(), and X.

Member Data Documentation

◆ DynamicAPInt

friend llvm::detail::SlowDynamicAPInt::DynamicAPInt

Definition at line 78 of file SlowDynamicAPInt.h.


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