mpn negation with borrow in

Torbjörn Granlund tg at
Fri Aug 22 13:53:50 UTC 2014

Vincent Lefevre <vincent at> writes:

  I was quite surprised to see that the mpn layer doesn't have a
  negation with borrow in,

You will be even more surprised when you see that we don't have any
(public) mpn functions with carry-in.

    * if the borrow is 0, use mpn_neg;
    * if the borrow is 1, use mpn_com.
  Is this the recommended way?
That's how I'd do it.  While mpn_com doesn't return "carry out", its
value in this context is quite predictable.

Please encrypt, key id 0xC8601622

More information about the gmp-discuss mailing list