Some feedback from a cursory read:

1. Mentioning cryptography might be a bad idea here.  None of these operations are guaranteed to be constant-time independent of data values, meaning implementations of big-number cryptography could be vulnerable to timing attacks.  This really applies to all of C++ though; operator *(unsigned long long, unsigned long long) already has data-dependent timing on many 32-bit implementations.

2. Another issue of sub_borrow is the way you intend to define the input and output carry flags.  CPUs whose history traces to Intel define the carry flag from a subtraction as “borrow”, whereas those that trace to MOS or Motorola tend to define the carry flag for subtraction as the NOT of the Intel way.  (ARM32 and ARM64 come to mind.)  Using the word “borrow” seems to imply that you’d standardize the Intel meaning.

3. “Amend” is misspelled “ammend”.

Melissa

On Thu, Jan 18, 2024 at 17:32 Tiago Freire via Std-Discussion <std-discussion@lists.isocpp.org> wrote:

Hi everyone,

I would like to submit a draft paper related to the introduction of functions in the <numeric> library related to overflow arithmetic in the same spirit of the “saturated” function family.

Feedback is appreciated; you can have an early read of the text here: https://kaotic.software/cpp_papers/overflow_arithmetic.html

I will be following up to put the paper into the formal channels.

Thanks,

Tiago Freire

--
Std-Discussion mailing list
Std-Discussion@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion