LLZK 0.1.0
Veridise's ZK Language IR
|
This file defines helpers for manipulating APInts/APSInts for large numbers and operations over those numbers that may require bit width changes. More...
#include <llvm/ADT/APSInt.h>
#include <llvm/ADT/StringRef.h>
#include <algorithm>
#include <initializer_list>
Go to the source code of this file.
Namespaces | |
namespace | llzk |
Functions | |
llvm::APSInt | llzk::expandingAdd (llvm::APSInt lhs, llvm::APSInt rhs) |
Safely add lhs and rhs, expanding the width of the result as necessary. | |
llvm::APSInt | llzk::expandingSub (llvm::APSInt lhs, llvm::APSInt rhs) |
Safely subtract lhs and rhs, expanding the width of the result as necessary. | |
llvm::APSInt | llzk::expandingMul (llvm::APSInt lhs, llvm::APSInt rhs) |
Safely multiple lhs and rhs, expanding the width of the result as necessary. | |
std::strong_ordering | llzk::safeCmp (llvm::APSInt lhs, llvm::APSInt rhs) |
Compares lhs and rhs, regardless of the bitwidth of lhs and rhs. | |
llvm::APSInt | llzk::safeToSigned (llvm::APSInt i) |
Safely converts the given int to a signed int if it is an unsigned int by adding an extra bit for the sign. | |
llvm::APSInt | llzk::safeToSigned (llvm::APInt i) |
llvm::APSInt | llzk::safeToSigned (llvm::StringRef s) |
bool | llzk::safeLt (const llvm::APSInt &lhs, const llvm::APSInt &rhs) |
bool | llzk::safeLe (const llvm::APSInt &lhs, const llvm::APSInt &rhs) |
bool | llzk::safeEq (const llvm::APSInt &lhs, const llvm::APSInt &rhs) |
bool | llzk::safeNe (const llvm::APSInt &lhs, const llvm::APSInt &rhs) |
bool | llzk::safeGt (const llvm::APSInt &lhs, const llvm::APSInt &rhs) |
bool | llzk::safeGe (const llvm::APSInt &lhs, const llvm::APSInt &rhs) |
llvm::APSInt | llzk::safeMin (const llvm::APSInt &lhs, const llvm::APSInt &rhs) |
llvm::APSInt | llzk::safeMin (std::initializer_list< llvm::APSInt > ilist) |
llvm::APSInt | llzk::safeMax (const llvm::APSInt &lhs, const llvm::APSInt &rhs) |
llvm::APSInt | llzk::safeMax (std::initializer_list< llvm::APSInt > ilist) |
This file defines helpers for manipulating APInts/APSInts for large numbers and operations over those numbers that may require bit width changes.
NOTE: MLIR 19/20 introduces a dynamic version of APInt that manages bitwidths automatically. When we upgrade LLZK to a newer version of MLIR, we can remove these utilities in favor of that.
Definition in file APIntHelper.h.