Merge pull request #1969 from Kurausukun/macros

Safeguard SQUARE and CUBE Macro Arguments in Parentheses
This commit is contained in:
GriffinR 2023-12-27 17:39:37 -05:00 committed by GitHub
commit 6c96641035
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,5 @@
#define SQUARE(n)(n * n)
#define CUBE(n)(n * n * n)
#define SQUARE(n)((n) * (n))
#define CUBE(n)((n) * (n) * (n))
#define EXP_SLOW(n)((5 * CUBE(n)) / 4) // (5 * (n)^3) / 4
#define EXP_FAST(n)((4 * CUBE(n)) / 5) // (4 * (n)^3) / 5