diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2009-11-06 09:03:08 +0300 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2009-11-06 21:01:45 +0300 |
commit | 09e2895fbeb014daccf80537083048171f12c621 (patch) | |
tree | b87b88a4ec8097f7a650ee01cc54f7a8c3d41431 /nasmlib.h | |
parent | 19f9f60efbc3f240a9cdb04b4c33e7812d78463c (diff) | |
download | nasm-09e2895fbeb014daccf80537083048171f12c621.tar.gz nasm-09e2895fbeb014daccf80537083048171f12c621.tar.bz2 nasm-09e2895fbeb014daccf80537083048171f12c621.zip |
Introduce is_power2 helper
We will need it for hash tables
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'nasmlib.h')
-rw-r--r-- | nasmlib.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -422,4 +422,7 @@ static inline bool overflow_unsigned(int64_t value, int bytes) int idata_bytes(int opcode); +/* check if value is power of 2 */ +#define is_power2(v) ((v) && ((v) & ((v) - 1)) == 0) + #endif |