LLVM 19.0.0git
Public Member Functions | Public Attributes | Friends | List of all members
llvm::detail::SlowDynamicAPInt Class Reference

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

#include "llvm/ADT/SlowDynamicAPInt.h"

Public Member Functions

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

Public Attributes

friend DynamicAPInt
 

Friends

SlowDynamicAPInt abs (const SlowDynamicAPInt &X)
 Redeclarations of friend declarations above to make it discoverable by lookups.
 
SlowDynamicAPInt ceilDiv (const SlowDynamicAPInt &LHS, const SlowDynamicAPInt &RHS)
 
SlowDynamicAPInt floorDiv (const SlowDynamicAPInt &LHS, const SlowDynamicAPInt &RHS)
 
SlowDynamicAPInt gcd (const SlowDynamicAPInt &A, const SlowDynamicAPInt &B)
 The operands must be non-negative for gcd.
 
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 34 of file SlowDynamicAPInt.h.

Constructor & Destructor Documentation

◆ SlowDynamicAPInt() [1/3]

SlowDynamicAPInt::SlowDynamicAPInt ( int64_t  Val)
explicit

Definition at line 17 of file SlowDynamicAPInt.cpp.

◆ SlowDynamicAPInt() [2/3]

SlowDynamicAPInt::SlowDynamicAPInt ( )

Definition at line 19 of file SlowDynamicAPInt.cpp.

Referenced by operator%(), operator*(), operator+(), operator-(), operator/(), and operator=().

◆ SlowDynamicAPInt() [3/3]

SlowDynamicAPInt::SlowDynamicAPInt ( const APInt Val)
explicit

Definition at line 20 of file SlowDynamicAPInt.cpp.

Member Function Documentation

◆ dump()

void SlowDynamicAPInt::dump ( ) const

Definition at line 286 of file SlowDynamicAPInt.cpp.

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

◆ getBitWidth()

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

Definition at line 79 of file SlowDynamicAPInt.h.

References llvm::APInt::getBitWidth().

◆ 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 llvm::APInt::sext().

◆ operator%()

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

This operation cannot overflow.

Definition at line 234 of file SlowDynamicAPInt.cpp.

References llvm::APInt::getBitWidth(), llvm::APInt::sext(), SlowDynamicAPInt(), and llvm::APInt::srem().

◆ operator%=()

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

Definition at line 267 of file SlowDynamicAPInt.cpp.

◆ operator*()

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

◆ operator*=()

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

Definition at line 259 of file SlowDynamicAPInt.cpp.

◆ operator+()

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

◆ operator++()

SlowDynamicAPInt & SlowDynamicAPInt::operator++ ( )

Definition at line 271 of file SlowDynamicAPInt.cpp.

◆ operator+=()

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

Assignment operators, preincrement, predecrement.

Definition at line 251 of file SlowDynamicAPInt.cpp.

◆ 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 llvm::APInt::getBitWidth(), llvm::APInt::isMinSignedValue(), llvm::APInt::sext(), and SlowDynamicAPInt().

◆ operator-() [2/2]

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

◆ operator--()

SlowDynamicAPInt & SlowDynamicAPInt::operator-- ( )

Definition at line 276 of file SlowDynamicAPInt.cpp.

◆ operator-=()

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

Definition at line 255 of file SlowDynamicAPInt.cpp.

◆ operator/()

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

◆ operator/=()

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

Definition at line 263 of file SlowDynamicAPInt.cpp.

◆ operator<()

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

Definition at line 138 of file SlowDynamicAPInt.cpp.

References getMaxWidth(), llvm::APInt::sext(), and llvm::APInt::slt().

◆ operator<=()

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

Definition at line 142 of file SlowDynamicAPInt.cpp.

References getMaxWidth(), llvm::APInt::sext(), and llvm::APInt::sle().

◆ operator=()

SlowDynamicAPInt & SlowDynamicAPInt::operator= ( int64_t  Val)

Definition at line 21 of file SlowDynamicAPInt.cpp.

References SlowDynamicAPInt().

◆ operator==()

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

Comparison operators.

Definition at line 126 of file SlowDynamicAPInt.cpp.

References getMaxWidth(), and llvm::APInt::sext().

◆ operator>()

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

Definition at line 134 of file SlowDynamicAPInt.cpp.

References getMaxWidth(), llvm::APInt::sext(), and llvm::APInt::sgt().

◆ operator>=()

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

Definition at line 146 of file SlowDynamicAPInt.cpp.

References getMaxWidth(), llvm::APInt::sext(), and llvm::APInt::sge().

◆ print()

void SlowDynamicAPInt::print ( raw_ostream OS) const

Printing.

Definition at line 284 of file SlowDynamicAPInt.cpp.

References OS.

Referenced by dump().

Friends And Related Function Documentation

◆ abs

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

◆ ceilDiv

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

◆ floorDiv

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

◆ gcd

The operands must be non-negative for gcd.

◆ hash_value

hash_code hash_value ( const SlowDynamicAPInt X)
friend

Overload to compute a hash_code for a SlowDynamicAPInt value.

Member Data Documentation

◆ DynamicAPInt

friend llvm::detail::SlowDynamicAPInt::DynamicAPInt

Definition at line 77 of file SlowDynamicAPInt.h.


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