tqchen opened a new pull request, #783:
URL: https://github.com/apache/tvm-ffi/pull/783

   This PR adds a canonical arbitrary-precision integer value with an inline
   int64 fast path and one variable-length object for larger values. BigInt
   is a tagged union that stores either an int64_t or a BigIntObj containing
   a dynamically sized array of 64-bit words.
   
   Key design details include:
   
   - Arithmetic automatically promotes to higher precision when needed,
     preserving integer results without overflow.
   - Storage is canonical: values that fit in int64_t are always stored
     inline, and BigIntObj never contains redundant sign-extension words.
   - Full integer operator coverage includes arithmetic, bitwise operations,
     shifts, comparisons, and compound assignments, with int64 fast paths
     and arbitrary-precision fallbacks.
   - The Python interface automatically exchanges BigInt values as native
     Python integers, preserving arbitrary precision in both directions.
   
   Several common int64 workloads are around 3–4× slower with BigInt than
   with raw int64_t. We recommend using BigInt when stored values may exceed
   the int64 range.
   
   Co-authored-by: Junru Shao <[email protected]>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to