0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-09-22 10:43:39 -04:00

Already aligned aligns should be 0 bytes, not %1.

This commit is contained in:
Victor van den Elzen
2008-10-01 13:16:26 +02:00
parent 4c9d6220b4
commit fd49408ed9
3 changed files with 7 additions and 6 deletions

View File

@@ -161,14 +161,14 @@ USE: smartalign
%unimacro align 1-2+.nolist %unimacro align 1-2+.nolist
%imacro align 1-2+.nolist %imacro align 1-2+.nolist
%ifnempty %2 %ifnempty %2
times ((%1) - (($-$$) % (%1))) %2 times (((%1) - (($-$$) % (%1))) % (%1)) %2
%else %else
%push %push
%assign %$pad (%1) - (($-$$) % (%1)) %assign %$pad (((%1) - (($-$$) % (%1))) % (%1))
%if %$pad > __ALIGN_JMP_THRESHOLD__ %if %$pad > __ALIGN_JMP_THRESHOLD__
jmp %$end jmp %$end
; We can't re-use %$pad here as $ will have changed! ; We can't re-use %$pad here as $ will have changed!
times ((%1) - (($-$$) % (%1))) nop times (((%1) - (($-$$) % (%1))) % (%1)) nop
%$end: %$end:
%else %else
%if __BITS__ == 16 %if __BITS__ == 16

View File

@@ -66,13 +66,13 @@ __SECT__
%endmacro %endmacro
%imacro align 1-2+.nolist nop %imacro align 1-2+.nolist nop
times ((%1) - (($-$$) % (%1))) %2 times (((%1) - (($-$$) % (%1))) % (%1)) %2
%endmacro %endmacro
%imacro alignb 1-2+.nolist %imacro alignb 1-2+.nolist
%ifempty %2 %ifempty %2
resb ((%1) - (($-$$) % (%1))) resb (((%1) - (($-$$) % (%1))) % (%1))
%else %else
times ((%1) - (($-$$) % (%1))) %2 times (((%1) - (($-$$) % (%1))) % (%1)) %2
%endif %endif
%endmacro %endmacro

View File

@@ -11,5 +11,6 @@
inc eax inc eax
inc eax inc eax
align 13 align 13
align 13 ;should do nothing
inc eax inc eax
inc eax inc eax