Adding a new macro to be able to determine if a given integer value is a power of 2

This commit is contained in:
etagle 2017-08-08 02:09:50 -03:00
parent 6440904c1c
commit b4c53af07d

View File

@ -99,6 +99,9 @@
#define CBI(n,b) (n &= ~_BV(b))
#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (_BV(b))
// Macro to check that a number if a power if 2
#define IS_POWEROF2(x) ((x) && !((x) & ((x) - 1)))
// Macros for maths shortcuts
#ifndef M_PI
#define M_PI 3.14159265358979323846