provide a gcc style alternative to the inline asm in tr_shade

This commit is contained in:
Jonathan Gray 2013-04-28 13:25:53 +10:00
parent c294d5e494
commit 8202db3fe1

View file

@ -398,6 +398,7 @@ inline int VectorToInt(vec3_t vec)
{
int tmp, retval;
#ifdef _MSVC_VER
_asm
{
push edx
@ -421,6 +422,21 @@ inline int VectorToInt(vec3_t vec)
mov [retval], eax
pop edx
}
#else
asm("flds %1;\n\t"
"flds %2;\n\t"
"flds %3;\n\t"
"fistp %4;\n\t"
"movb %4, %%al;\n\t"
"shl $16, %0;\n\t"
"fistp %4;\n\t"
"movb %4, %%ah;\n\t"
"fistp %4;\n\t"
"movb %4, %%al;\n\t"
: "=a"(retval)
: "m"(vec[0]), "m"(vec[1]), "m"(vec[2]), "m"(tmp), "a"(0xff00)
);
#endif
return(retval);
}