[Mlir-commits] [mlir] [mlir][python] Support Arbitrary Precision Integers in MLIR C API and Python Bindings (PR #177733)
Maksim Levental
llvmlistbot at llvm.org
Sat Jan 24 09:42:55 PST 2026
================
@@ -165,6 +165,32 @@ MLIR_CAPI_EXPORTED int64_t mlirIntegerAttrGetValueSInt(MlirAttribute attr);
/// is of unsigned type and fits into an unsigned 64-bit integer.
MLIR_CAPI_EXPORTED uint64_t mlirIntegerAttrGetValueUInt(MlirAttribute attr);
+/// Returns the bit width of the integer attribute's underlying APInt value.
+/// This is useful for determining the size of the integer, especially for
+/// values larger than 64 bits.
+MLIR_CAPI_EXPORTED unsigned mlirIntegerAttrGetValueBitWidth(MlirAttribute attr);
+
+/// Returns the number of 64-bit words that make up the integer attribute's
+/// underlying APInt value. For integers <= 64 bits, this returns 1.
+MLIR_CAPI_EXPORTED unsigned mlirIntegerAttrGetValueNumWords(MlirAttribute attr);
+
+/// Copies the 64-bit words comprising the integer attribute's APInt value into
----------------
makslevental wrote:
nit
```suggestion
/// Copies the 64-bit words making up the integer attribute's APInt value into
```
FYI comprising is meant to be used like this:
> "The house, comprising four rooms, was sold"
i.e., the object is of the verb is the whole not the parts
https://github.com/llvm/llvm-project/pull/177733
More information about the Mlir-commits
mailing list