mpz_perfect_power_p

Vincent Lefevre vincent at vinc17.org
Tue Dec 23 17:14:05 CET 2008


On 2008-12-23 04:53:54 +0100, Torbjorn Granlund wrote:
> +#define POW2P(a) ((a & (a-1)) == 0)

Even though this is not needed here, putting parentheses would make
the code more maintainable:

  #define POW2P(a) (((a) & ((a)-1)) == 0)

(this is also a matter of good habits).

Regards,

-- 
Vincent Lefèvre <vincent at vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


More information about the gmp-bugs mailing list