diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2010-02-11 09:03:51 +0300 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2010-02-11 21:28:27 +0300 |
commit | 89fe355ad00d49aa0a8514a76dfd0745d29cfd09 (patch) | |
tree | 4579128aa6c4f1c5644fabe103876779ebb14386 | |
parent | 53252e0cc3d44a781643da3958060548695e457e (diff) | |
download | nasm-89fe355ad00d49aa0a8514a76dfd0745d29cfd09.tar.gz |
nasmlib.h: Introduce ALIGN helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r-- | nasmlib.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -255,6 +255,13 @@ void standard_extension(char *inname, char *outname, char *extension); pos = n, n = (n ? n->next : NULL)) /* + * Power of 2 align helpers + */ +#define ALIGN_MASK(v, mask) (((v) + (mask)) & ~(mask)) +#define ALIGN(v, a) ALIGN_MASK(v, (a) - 1) +#define IS_ALIGNED(v, a) (((v) & ((a) - 1)) == 0) + +/* * some handy macros that will probably be of use in more than one * output format: convert integers into little-endian byte packed * format in memory |