projects
/
platform
/
upstream
/
nasm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
53252e0
)
nasmlib.h: Introduce ALIGN helpers
author
Cyrill Gorcunov
<gorcunov@gmail.com>
Thu, 11 Feb 2010 06:03:51 +0000
(09:03 +0300)
committer
Cyrill Gorcunov
<gorcunov@gmail.com>
Thu, 11 Feb 2010 18:28:27 +0000
(21:28 +0300)
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
nasmlib.h
patch
|
blob
|
history
diff --git
a/nasmlib.h
b/nasmlib.h
index
372095c
..
793fccd
100644
(file)
--- a/
nasmlib.h
+++ b/
nasmlib.h
@@
-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