helper/align.h: Fix macro IS_PWR_OF_2
Zero is not a power of two.
All functions that use IS_PWR_OF_2 were checked and the edge case
of IS_PWR_OF_2(0) does not occur anywhere at the moment. Therefore
the fix is safe.
Change-Id: I84d9f9c64c9a7df452ca6e99c2ee4169ccb2b0be
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Fixes: 9544cd653d
("helper: add align.h")
Reviewed-on: https://review.openocd.org/c/openocd/+/8511
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
parent
30c3d077f2
commit
edf2c82cf6
|
@ -24,7 +24,7 @@
|
|||
#define IS_PWR_OF_2(x) \
|
||||
({ \
|
||||
typeof(x) _x = (x); \
|
||||
_x == 0 || (_x & (_x - 1)) == 0; \
|
||||
_x != 0 && (_x & (_x - 1)) == 0; \
|
||||
})
|
||||
|
||||
#endif /* OPENOCD_HELPER_ALIGN_H */
|
||||
|
|
Loading…
Reference in New Issue