summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-09-25 02:31:50 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-09-25 02:31:50 -0700
commit152656f8d3c34a1a5efef6d512439fc686690ecf (patch)
tree7276331cf0219c2f3ac72a92d064a895c4b67834 /macros
parent6e79efc26b04dc7e82b528e8ff3e5f92d5f284b7 (diff)
downloadnasm-152656f8d3c34a1a5efef6d512439fc686690ecf.tar.gz
Actually make non-power-of-2 alignments work
We can't use ($$-$) % (%1) since the wraparound will be wrong except for powers of 2. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'macros')
-rw-r--r--macros/smartalign.mac6
1 files changed, 3 insertions, 3 deletions
diff --git a/macros/smartalign.mac b/macros/smartalign.mac
index b79a8549..2c45d284 100644
--- a/macros/smartalign.mac
+++ b/macros/smartalign.mac
@@ -161,14 +161,14 @@ USE: smartalign
%unimacro align 1-2+.nolist
%imacro align 1-2+.nolist
%ifnempty %2
- times ($$-$) % (%1) %2
+ times ((%1) - (($-$$) % (%1))) %2
%else
%push
- %assign %$pad ($$-$) % %1
+ %assign %$pad (%1) - (($-$$) % (%1))
%if %$pad > __ALIGN_JMP_THRESHOLD__
jmp %$end
; We can't re-use %$pad here as $ will have changed!
- times ($$-$) % %1 db 90h
+ times ((%1) - (($-$$) % (%1))) nop
%$end:
%else
%if __BITS__ == 16