mirror of
https://github.com/yasm/yasm
synced 2026-08-26 22:26:05 -04:00
Make life a little easier by adding an is_exp2() macro.
svn path=/trunk/yasm/; revision=1682
This commit is contained in:
parent
9fde4e1657
commit
5ab6b53062
6 changed files with 20 additions and 13 deletions
7
util.h
7
util.h
|
|
@ -151,6 +151,13 @@
|
|||
d = BC_COUNT(d, 4); \
|
||||
} while (0)
|
||||
|
||||
/** Determine if a value is exactly a power of 2. Zero is treated as a power
|
||||
* of two.
|
||||
* \param x value
|
||||
* \return Nonzero if x is a power of 2.
|
||||
*/
|
||||
#define is_exp2(x) ((x & (x - 1)) == 0)
|
||||
|
||||
#ifndef NELEMS
|
||||
/** Get the number of elements in an array.
|
||||
* \internal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue