|
LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
|
This file implements helpers for DynamicAPInt operations and conversions that LLVM does not provide. More...
#include "llzk/Util/Compare.h"#include <llvm/ADT/APInt.h>#include <llvm/ADT/APSInt.h>#include <llvm/ADT/ArrayRef.h>#include <llvm/ADT/DynamicAPInt.h>#include <llvm/ADT/Hashing.h>#include <llvm/ADT/StringRef.h>#include <llvm/ADT/Twine.h>#include <llvm/Support/Error.h>#include <climits>#include <concepts>#include <cstddef>#include <cstdint>#include <limits>Go to the source code of this file.
Namespaces | |
| namespace | llzk |
Functions | |
| llvm::Expected< llvm::DynamicAPInt > | llzk::parseDynamicAPInt (llvm::StringRef str) |
| Parse a signed decimal integer, rejecting malformed input without asserting. | |
| llvm::hash_code | llzk::hashDynamicAPInt (const llvm::DynamicAPInt &value) |
| Hash the signed numeric value, independent of its width or arithmetic history. | |
| llvm::Expected< llvm::APInt > | llzk::checkedToAPInt (const llvm::DynamicAPInt &value, unsigned bitWidth, bool isSigned) |
| Encode a signed or unsigned integer at exactly bitWidth, rejecting overflow. | |
| llvm::Expected< int64_t > | llzk::checkedToInt64 (const llvm::DynamicAPInt &value) |
| Convert to a native signed integer, rejecting values outside its range. | |
| llvm::Expected< uint64_t > | llzk::checkedToUInt64 (const llvm::DynamicAPInt &value) |
| Convert to a native unsigned integer, rejecting negative values and overflow. | |
| llvm::Expected< size_t > | llzk::checkedToSize (const llvm::DynamicAPInt &value, const llvm::Twine &context) |
| Convert to size_t, rejecting negative values and overflow. | |
| llvm::DynamicAPInt | llzk::operator& (const llvm::DynamicAPInt &lhs, const llvm::DynamicAPInt &rhs) |
| Bitwise operations use infinite two's-complement sign extension. | |
| llvm::DynamicAPInt | llzk::operator| (const llvm::DynamicAPInt &lhs, const llvm::DynamicAPInt &rhs) |
| llvm::DynamicAPInt | llzk::operator^ (const llvm::DynamicAPInt &lhs, const llvm::DynamicAPInt &rhs) |
| llvm::DynamicAPInt | llzk::operator<< (const llvm::DynamicAPInt &lhs, const llvm::DynamicAPInt &rhs) |
| Exact left shift. | |
| llvm::DynamicAPInt | llzk::operator<< (const llvm::DynamicAPInt &lhs, int64_t rhs) |
| Exact left shift. | |
| llvm::DynamicAPInt | llzk::operator>> (const llvm::DynamicAPInt &lhs, const llvm::DynamicAPInt &rhs) |
| Arithmetic right shift. | |
| llvm::DynamicAPInt | llzk::operator>> (const llvm::DynamicAPInt &lhs, int64_t rhs) |
| Arithmetic right shift. | |
| template<std::unsigned_integral T> | |
| llvm::DynamicAPInt | llzk::operator>> (const llvm::DynamicAPInt &lhs, T rhs) |
| Arithmetic right shift by an unsigned count, checked before conversion to int64_t. | |
| llvm::DynamicAPInt | llzk::toDynamicAPInt (llvm::StringRef str) |
| Parse trusted decimal text; invalid text is a fatal programming error. | |
| llvm::DynamicAPInt | llzk::toDynamicAPInt (const llvm::APSInt &i) |
| llvm::DynamicAPInt | llzk::toDynamicAPInt (const llvm::APInt &i) |
| Converts an APInt to a DynamicAPInt, using an unsigned interpretation. | |
| llvm::DynamicAPInt | llzk::toSignedDynamicAPInt (llvm::ArrayRef< uint64_t > parts) |
| Decode 64-bit parts in LSB order as a two's-complement signed integer. | |
| llvm::DynamicAPInt | llzk::toDynamicAPInt (size_t i) |
| llvm::APSInt | llzk::toAPSInt (const llvm::DynamicAPInt &i) |
| Convert to a signed APSInt with the same numeric value (bit width is unspecified). | |
| llvm::DynamicAPInt | llzk::modExp (const llvm::DynamicAPInt &base, const llvm::DynamicAPInt &exp, const llvm::DynamicAPInt &mod) |
| Modular exponentiation for a nonnegative exponent and positive modulus. | |
| llvm::DynamicAPInt | llzk::modInversePrime (const llvm::DynamicAPInt &f, const llvm::DynamicAPInt &p) |
This file implements helpers for DynamicAPInt operations and conversions that LLVM does not provide.
Note that of the operators defined, bitwise negation ('~') is not implemented. This is because the definition of this operation requires the number of bits to be defined, which may change with dynamically sized integers.
Definition in file DynamicAPIntHelper.h.