sqrt algorithm

Torbjörn Granlund tg at gmplib.org
Sat Aug 15 11:59:08 UTC 2015

tg at gmplib.org (Torbjörn Granlund) writes:

  I suppose it used to suggest a bad order, while now it suggests a good
  eval order.  (While the initial separate statements means there was a
  "sequence point" in C parlance, the compiler may reorder things as the
  call can not modify the local expression's result.)
This reasoning is not 100% correct.

The expression uses up[], and the compiler cannot assume the memory
pointed to by up to be unmodified by the mpn_addmul_1 call.

(If we dared use the restrict keyword for the addmul_1 pointers, we'd
give more freedom to the compiler.  This is a sticky area, since
restrict's semantics do not fit GMP's needs well.)

Please encrypt, key id 0xC8601622

More information about the gmp-devel mailing list