mpn negation with borrow in

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


Vincent Lefevre <vincent at vinc17.org> 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.


Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-discuss mailing list