Merge pull request #706 from cxd4/att-asm-is-dumb
Remove incompatible in-line asm from DepthBufferRender.
This commit is contained in:
commit
c67d64031b
|
@ -87,41 +87,17 @@ static int left_z, left_dzdy;
|
||||||
|
|
||||||
__inline int imul16(int x, int y) // (x * y) >> 16
|
__inline int imul16(int x, int y) // (x * y) >> 16
|
||||||
{
|
{
|
||||||
return (((long long)x) * ((long long)y)) >> 16;
|
return ((int64_t)x * (int64_t)y) >> 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
__inline int imul14(int x, int y) // (x * y) >> 14
|
__inline int imul14(int x, int y) // (x * y) >> 14
|
||||||
{
|
{
|
||||||
return (((long long)x) * ((long long)y)) >> 14;
|
return ((int64_t)x * (int64_t)y) >> 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
__inline int idiv16(int x, int y) // (x << 16) / y
|
__inline int idiv16(int x, int y) // (x << 16) / y
|
||||||
{
|
{
|
||||||
//x = (((long long)x) << 16) / ((long long)y);
|
x = ((int64_t)x << 16) / (int64_t)y;
|
||||||
/*
|
|
||||||
eax = x;
|
|
||||||
ebx = y;
|
|
||||||
edx = x;
|
|
||||||
(x << 16) | ()
|
|
||||||
*/
|
|
||||||
#if !defined(__GNUC__) && !defined(NO_ASM)
|
|
||||||
__asm {
|
|
||||||
mov eax, x
|
|
||||||
mov ebx, y
|
|
||||||
mov edx,eax
|
|
||||||
sar edx,16
|
|
||||||
shl eax,16
|
|
||||||
idiv ebx
|
|
||||||
mov x, eax
|
|
||||||
}
|
|
||||||
#elif !defined(NO_ASM)
|
|
||||||
int reminder;
|
|
||||||
asm ("idivl %[divisor]"
|
|
||||||
: "=a" (x), "=d" (reminder)
|
|
||||||
: [divisor] "g" (y), "d" (x >> 16), "a" (x << 16));
|
|
||||||
#else
|
|
||||||
x = (((long long)x) << 16) / ((long long)y);
|
|
||||||
#endif
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue