include \masm32\include\masm32rt.inc ; plain Masm32
@signed$ MACRO arg ; returns signed immediate as string (borrowed from MasmBasic)
if arg lt 0
EXITM @CatStr(<->, %(-arg))
else
EXITM %arg
endif
endm
negnum=80000000h
echo using 80000000h:
if negnum lt 0
echo number is negative
else
echo number is positive
endif
tmp$ CATSTR < TheNumber=>, %negnum
% echo tmp$
tmp$ CATSTR < TheNumber=>, @signed$(negnum)
% echo tmp$
echo
negnum=-2147483648
echo using -2147483648:
if negnum lt 0
echo number is negative
else
echo number is positive
endif
tmp$ CATSTR < TheNumber=>, %negnum
% echo tmp$
tmp$ CATSTR < TheNumber=>, @signed$(negnum)
% echo tmp$
.code
start:
exit
.err <--- ok -->
end start
Output:
using 80000000h:
number is positive
TheNumber=2147483648
TheNumber=2147483648
using -2147483648:
number is negative
TheNumber=2147483648
TheNumber=-2147483648
IMHO 80000000h and -2147483648 should be, ehm, roughly the same ::)
MASM constants range from -4294967295 to 4294967295.
See https://sourceforge.net/p/jwasm/bugs/47/
Quote from: qWord on May 03, 2016, 10:00:39 PM
MASM constants range from -4294967295 to 4294967295.
Good to know, thanks :t
Quotesymbolic constants ( EQU and '=' ) do have 32+1 bits
deleted
> cmp rax,4294967297 ; Error A2235: Constant value too large: 100000001h
I wonder, though, why the comparison of a "33-bit" number to a 64-bit register should fail ::)
deleted