data61 / cuda-fixnum

Extended-precision modular arithmetic library that targets CUDA.
Other
41 stars 28 forks source link

Allow checking for overflow without penalising fast path #51

Open unzvfu opened 6 years ago

unzvfu commented 6 years ago

Currently, to assert that addition doesn't overflow, we

add_cy(s, cy, a, b);
assert(digit::is_zero(cy));

If NDEBUG is not set, then this checks that overflow hasn't occurred. If NDEBUG is set, it's possible (need to verify) that some carry handling code is generated; this is wasteful as it isn't used.

unzvfu commented 4 years ago

Follow up at https://github.com/unzvfu/cuda-fixnum/issues/31.