LLVM 20.0.0git
Functions
SlowDynamicAPInt.cpp File Reference
#include "llvm/ADT/SlowDynamicAPInt.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"

Go to the source code of this file.

Functions

static unsigned getMaxWidth (const APInt &A, const APInt &B)
 
APInt runOpWithExpandOnOverflow (const APInt &A, const APInt &B, function_ref< APInt(const APInt &, const APInt &, bool &Overflow)> Op)
 Bring a and b to have the same width and then call op(a, b, overflow).
 

Function Documentation

◆ getMaxWidth()

static unsigned getMaxWidth ( const APInt A,
const APInt B 
)
static

◆ runOpWithExpandOnOverflow()

APInt runOpWithExpandOnOverflow ( const APInt A,
const APInt B,
function_ref< APInt(const APInt &, const APInt &, bool &Overflow)>  Op 
)

Bring a and b to have the same width and then call op(a, b, overflow).


Arithmetic operators.

If the overflow bit becomes set, resize a and b to double the width and call op(a, b, overflow), returning its result. The operation with double widths should not also overflow.

Definition at line 159 of file SlowDynamicAPInt.cpp.

References A, assert(), B, and getMaxWidth().

Referenced by llvm::detail::SlowDynamicAPInt::operator*(), llvm::detail::SlowDynamicAPInt::operator+(), llvm::detail::SlowDynamicAPInt::operator-(), and llvm::detail::SlowDynamicAPInt::operator/().