[Nasm-bugs] [Bug 3392747] git nasm: bitshift left by 1 (<< 1) in %assign appears to shift right

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Wed Mar 24 13:11:40 PDT 2021


https://bugzilla.nasm.us/show_bug.cgi?id=3392747

--- Comment #2 from C. Masloch <pushbx at ulukai.org> ---
Same test case except using equ, which works fine:


$ perl -pe 's/^\%assign\s+(\S+)\s+/$1 equ /' test2.asm > test3.asm
$ cat test3.asm

%idefine words(b)       ((b)+1>>1)
%idefine fromwords(w)           ((w)<<1)

LOADCMDLINE_size equ 256
ll equ fromwords(words(LOADCMDLINE_size))
mm equ LOADCMDLINE_size
nn equ (words(LOADCMDLINE_size))
oo equ fromwords(nn)

dw ll           ; expected 0100h
dw mm           ; expected 0100h
dw nn           ; expected 0080h
dw oo           ; expected 0100h
$ newnasm test3.asm -l /dev/stderr
     1
     2                                  %idefine words(b)       ((b)+1>>1)
     3                                  %idefine fromwords(w)          
((w)<<1)
     4
     5                                  LOADCMDLINE_size equ 256
     6                                  ll equ
fromwords(words(LOADCMDLINE_size))
     7                                  mm equ LOADCMDLINE_size
     8                                  nn equ (words(LOADCMDLINE_size))
     9                                  oo equ fromwords(nn)
    10
    11 00000000 0001                    dw ll           ; expected 0100h
    12 00000002 0001                    dw mm           ; expected 0100h
    13 00000004 8000                    dw nn           ; expected 0080h
    14 00000006 0001                    dw oo           ; expected 0100h
$

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.


More information about the Nasm-bugs mailing list