include \masm32\include\masm32rt.inc ; pure Masm32 code
pushFpu macro arg
if High32(arg)
% echo QWORD: arg
push High32(arg)
push Low32(arg)
fild qword ptr [esp]
add esp, 8
else
% echo DWORD: arg
push arg
fild dword ptr [esp]
add esp, 4
endif
ENDM
.data?
somevar REAL8 ?
.code
start:
pushFpu 123
fstp somevar
printf("The value is %f\n", somevar)
pushFpu 123456789012345
fstp somevar
printf("The value is %f\n", somevar)
inkey "cute..."
exit
end start
Works like a charm :thumbsup:
The value is 123.000000
The value is 123456789012345.000000
Re HIGH32, see Microsoft docs, operator HIGH32 (https://docs.microsoft.com/en-us/cpp/assembler/masm/operator-high32?view=vs-2019):
QuoteReturns the high 32 bits of expression. MASM expressions are 64-bit values.