NASM Bug and rax, 0x1000000000

Programming, for all ages and all languages.
Post Reply
tsdnz
Member
Member
Posts: 333
Joined: Sun Jun 16, 2013 4:09 am

NASM Bug and rax, 0x1000000000

Post by tsdnz »

Hi, this is my macro.

%macro ExtractBits 3; %1 = Register, %2 = Starting Bit, %3 = Ending Bits
%if %2 > 0
shr %1, %2
%endif
and %1, ((1 << (%3 - %2)) - 1)
%endmacro

but the nasm compiler displays this warning:
warning: signed dword immediate exceeds bounds

Does anyone know how to fix this?
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: NASM Bug and rax, 0x1000000000

Post by bluemoon »

I support you meant you get warning with and rax, 0x1000000000
This has nothing to do with macro, x86_64 cpu do not support imm64 for such instruction.
You may do a move to reg then and reg64,reg64 them.
Read the manual for detail.
tsdnz
Member
Member
Posts: 333
Joined: Sun Jun 16, 2013 4:09 am

Re: NASM Bug and rax, 0x1000000000

Post by tsdnz »

Cheers mate, moved to r15 and used this to do the and.
I just assumed it was 64 bit.
Post Reply