mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
- removed several unused fixed point math functions from the inlines headers.
This commit is contained in:
parent
eab06ef086
commit
86909ecdb2
3 changed files with 0 additions and 312 deletions
|
@ -20,11 +20,6 @@ static __forceinline SDWORD Scale (SDWORD a, SDWORD b, SDWORD c)
|
|||
return (SDWORD)(((SQWORD)a*b)/c);
|
||||
}
|
||||
|
||||
static __forceinline SDWORD MulScale (SDWORD a, SDWORD b, SDWORD c)
|
||||
{
|
||||
return (SDWORD)(((SQWORD)a*b)>>c);
|
||||
}
|
||||
|
||||
static __forceinline SDWORD MulScale1 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 1); }
|
||||
static __forceinline SDWORD MulScale2 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 2); }
|
||||
static __forceinline SDWORD MulScale3 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a * b) >> 3); }
|
||||
|
@ -60,11 +55,6 @@ static __forceinline SDWORD MulScale32 (SDWORD a, SDWORD b) { return (SDWORD)(((
|
|||
|
||||
static __forceinline DWORD UMulScale16 (DWORD a, DWORD b) { return (DWORD)(((QWORD)a * b) >> 16); }
|
||||
|
||||
static __forceinline SDWORD DMulScale (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD s)
|
||||
{
|
||||
return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> s);
|
||||
}
|
||||
|
||||
static __forceinline SDWORD DMulScale1 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 1); }
|
||||
static __forceinline SDWORD DMulScale2 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 2); }
|
||||
static __forceinline SDWORD DMulScale3 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 3); }
|
||||
|
@ -98,53 +88,6 @@ static __forceinline SDWORD DMulScale30 (SDWORD a, SDWORD b, SDWORD c, SDWORD d)
|
|||
static __forceinline SDWORD DMulScale31 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 31); }
|
||||
static __forceinline SDWORD DMulScale32 (SDWORD a, SDWORD b, SDWORD c, SDWORD d) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d) >> 32); }
|
||||
|
||||
static __forceinline SDWORD TMulScale1 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 1); }
|
||||
static __forceinline SDWORD TMulScale2 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 2); }
|
||||
static __forceinline SDWORD TMulScale3 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 3); }
|
||||
static __forceinline SDWORD TMulScale4 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 4); }
|
||||
static __forceinline SDWORD TMulScale5 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 5); }
|
||||
static __forceinline SDWORD TMulScale6 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 6); }
|
||||
static __forceinline SDWORD TMulScale7 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 7); }
|
||||
static __forceinline SDWORD TMulScale8 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 8); }
|
||||
static __forceinline SDWORD TMulScale9 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 9); }
|
||||
static __forceinline SDWORD TMulScale10 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 10); }
|
||||
static __forceinline SDWORD TMulScale11 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 11); }
|
||||
static __forceinline SDWORD TMulScale12 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 12); }
|
||||
static __forceinline SDWORD TMulScale13 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 13); }
|
||||
static __forceinline SDWORD TMulScale14 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 14); }
|
||||
static __forceinline SDWORD TMulScale15 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 15); }
|
||||
static __forceinline SDWORD TMulScale16 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 16); }
|
||||
static __forceinline SDWORD TMulScale17 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 17); }
|
||||
static __forceinline SDWORD TMulScale18 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 18); }
|
||||
static __forceinline SDWORD TMulScale19 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 19); }
|
||||
static __forceinline SDWORD TMulScale20 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 20); }
|
||||
static __forceinline SDWORD TMulScale21 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 21); }
|
||||
static __forceinline SDWORD TMulScale22 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 22); }
|
||||
static __forceinline SDWORD TMulScale23 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 23); }
|
||||
static __forceinline SDWORD TMulScale24 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 24); }
|
||||
static __forceinline SDWORD TMulScale25 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 25); }
|
||||
static __forceinline SDWORD TMulScale26 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 26); }
|
||||
static __forceinline SDWORD TMulScale27 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 27); }
|
||||
static __forceinline SDWORD TMulScale28 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 28); }
|
||||
static __forceinline SDWORD TMulScale29 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 29); }
|
||||
static __forceinline SDWORD TMulScale30 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 30); }
|
||||
static __forceinline SDWORD TMulScale31 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 31); }
|
||||
static __forceinline SDWORD TMulScale32 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) { return (SDWORD)(((SQWORD)a*b + (SQWORD)c*d + (SQWORD)e*f) >> 32); }
|
||||
|
||||
static __forceinline SDWORD BoundMulScale (SDWORD a, SDWORD b, SDWORD c)
|
||||
{
|
||||
SQWORD x = ((SQWORD)a * b) >> c;
|
||||
return x > 0x7FFFFFFFll ? 0x7FFFFFFF :
|
||||
x < -0x80000000ll ? 0x80000000 :
|
||||
(SDWORD)x;
|
||||
}
|
||||
|
||||
static inline SDWORD DivScale (SDWORD a, SDWORD b, SDWORD c)
|
||||
{
|
||||
return (SDWORD)(((SQWORD)a << c) / b);
|
||||
}
|
||||
|
||||
static inline SDWORD DivScale1 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 1) / b); }
|
||||
static inline SDWORD DivScale2 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 2) / b); }
|
||||
static inline SDWORD DivScale3 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 3) / b); }
|
||||
static inline SDWORD DivScale4 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 4) / b); }
|
||||
|
@ -175,5 +118,4 @@ static inline SDWORD DivScale28 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)
|
|||
static inline SDWORD DivScale29 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 29) / b); }
|
||||
static inline SDWORD DivScale30 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 30) / b); }
|
||||
static inline SDWORD DivScale31 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 31) / b); }
|
||||
static inline SDWORD DivScale32 (SDWORD a, SDWORD b) { return (SDWORD)(((SQWORD)a << 32) / b); }
|
||||
|
||||
|
|
116
src/gccinlines.h
116
src/gccinlines.h
|
@ -47,23 +47,6 @@ static inline SDWORD Scale (SDWORD a, SDWORD b, SDWORD c)
|
|||
return result;
|
||||
}
|
||||
|
||||
static inline SDWORD MulScale (SDWORD a, SDWORD b, SDWORD c)
|
||||
{
|
||||
SDWORD result, dummy;
|
||||
|
||||
asm volatile
|
||||
("imull %3\n\t"
|
||||
"shrdl %b4,%1,%0"
|
||||
: "=a,a,a,a" (result),
|
||||
"=d,d,d,d" (dummy)
|
||||
: "a,a,a,a" (a),
|
||||
"m,r,m,r" (b),
|
||||
"c,c,I,I" (c)
|
||||
: "cc"
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define MAKECONSTMulScale(s) \
|
||||
static inline SDWORD MulScale##s (SDWORD a, SDWORD b) { return ((SQWORD)a * b) >> s; }
|
||||
|
||||
|
@ -143,92 +126,6 @@ MAKECONSTDMulScale(31)
|
|||
MAKECONSTDMulScale(32)
|
||||
#undef MAKECONSTDMulScale
|
||||
|
||||
#define MAKECONSTTMulScale(s) \
|
||||
static inline SDWORD TMulScale##s (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD ee) \
|
||||
{ \
|
||||
return (((SQWORD)a * b) + ((SQWORD)c * d) + ((SQWORD)e * ee)) >> s; \
|
||||
}
|
||||
|
||||
MAKECONSTTMulScale(1)
|
||||
MAKECONSTTMulScale(2)
|
||||
MAKECONSTTMulScale(3)
|
||||
MAKECONSTTMulScale(4)
|
||||
MAKECONSTTMulScale(5)
|
||||
MAKECONSTTMulScale(6)
|
||||
MAKECONSTTMulScale(7)
|
||||
MAKECONSTTMulScale(8)
|
||||
MAKECONSTTMulScale(9)
|
||||
MAKECONSTTMulScale(10)
|
||||
MAKECONSTTMulScale(11)
|
||||
MAKECONSTTMulScale(12)
|
||||
MAKECONSTTMulScale(13)
|
||||
MAKECONSTTMulScale(14)
|
||||
MAKECONSTTMulScale(15)
|
||||
MAKECONSTTMulScale(16)
|
||||
MAKECONSTTMulScale(17)
|
||||
MAKECONSTTMulScale(18)
|
||||
MAKECONSTTMulScale(19)
|
||||
MAKECONSTTMulScale(20)
|
||||
MAKECONSTTMulScale(21)
|
||||
MAKECONSTTMulScale(22)
|
||||
MAKECONSTTMulScale(23)
|
||||
MAKECONSTTMulScale(24)
|
||||
MAKECONSTTMulScale(25)
|
||||
MAKECONSTTMulScale(26)
|
||||
MAKECONSTTMulScale(27)
|
||||
MAKECONSTTMulScale(28)
|
||||
MAKECONSTTMulScale(29)
|
||||
MAKECONSTTMulScale(30)
|
||||
MAKECONSTTMulScale(31)
|
||||
MAKECONSTTMulScale(32)
|
||||
#undef MAKECONSTTMulScale
|
||||
|
||||
static inline SDWORD BoundMulScale (SDWORD a, SDWORD b, SDWORD c)
|
||||
{
|
||||
union {
|
||||
long long big;
|
||||
struct
|
||||
{
|
||||
int l, h;
|
||||
};
|
||||
} u;
|
||||
u.big = ((long long)a * b) >> c;
|
||||
if ((u.h ^ u.l) < 0 || (unsigned int)(u.h+1) > 1) return (u.h >> 31) ^ 0x7fffffff;
|
||||
return u.l;
|
||||
}
|
||||
|
||||
static inline SDWORD DivScale (SDWORD a, SDWORD b, SDWORD c)
|
||||
{
|
||||
SDWORD result, dummy;
|
||||
SDWORD lo = a << c;
|
||||
SDWORD hi = a >> (-c);
|
||||
|
||||
asm volatile
|
||||
("idivl %4"
|
||||
:"=a" (result),
|
||||
"=d" (dummy)
|
||||
: "a" (lo),
|
||||
"d" (hi),
|
||||
"r" (b)
|
||||
: "cc");
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline SDWORD DivScale1 (SDWORD a, SDWORD b)
|
||||
{
|
||||
SDWORD result, dummy;
|
||||
|
||||
asm volatile
|
||||
("addl %%eax,%%eax\n\t"
|
||||
"sbbl %%edx,%%edx\n\t"
|
||||
"idivl %3"
|
||||
:"=a,a" (result),
|
||||
"=&d,d" (dummy)
|
||||
: "a,a" (a),
|
||||
"r,m" (b)
|
||||
: "cc");
|
||||
return result;
|
||||
}
|
||||
|
||||
#define MAKECONSTDivScale(s) \
|
||||
static inline SDWORD DivScale##s (SDWORD a, SDWORD b) \
|
||||
|
@ -277,16 +174,3 @@ MAKECONSTDivScale(30)
|
|||
MAKECONSTDivScale(31)
|
||||
#undef MAKECONSTDivScale
|
||||
|
||||
static inline SDWORD DivScale32 (SDWORD a, SDWORD b)
|
||||
{
|
||||
SDWORD result = 0, dummy;
|
||||
|
||||
asm volatile
|
||||
("idivl %3"
|
||||
:"+a,a" (result),
|
||||
"=d,d" (dummy)
|
||||
: "d,d" (a),
|
||||
"r,m" (b)
|
||||
: "cc");
|
||||
return result;
|
||||
}
|
||||
|
|
138
src/mscinlines.h
138
src/mscinlines.h
|
@ -27,14 +27,6 @@ __forceinline SDWORD Scale (SDWORD a, SDWORD b, SDWORD c)
|
|||
__asm idiv c
|
||||
}
|
||||
|
||||
__forceinline SDWORD MulScale (SDWORD a, SDWORD b, SDWORD c)
|
||||
{
|
||||
__asm mov eax,a
|
||||
__asm mov ecx,c
|
||||
__asm imul b
|
||||
__asm shrd eax,edx,cl
|
||||
}
|
||||
|
||||
#define MAKECONSTMulScale(s) \
|
||||
__forceinline SDWORD MulScale##s (SDWORD a, SDWORD b) \
|
||||
{ \
|
||||
|
@ -89,20 +81,6 @@ __forceinline DWORD UMulScale16(DWORD a, DWORD b)
|
|||
__asm shrd eax,edx,16
|
||||
}
|
||||
|
||||
__forceinline SDWORD DMulScale (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD s)
|
||||
{
|
||||
__asm mov eax,a
|
||||
__asm imul b
|
||||
__asm mov ebx,eax
|
||||
__asm mov eax,c
|
||||
__asm mov esi,edx
|
||||
__asm mov ecx,s
|
||||
__asm imul d
|
||||
__asm add eax,ebx
|
||||
__asm adc edx,esi
|
||||
__asm shrd eax,edx,cl
|
||||
}
|
||||
|
||||
#define MAKECONSTDMulScale(s) \
|
||||
__forceinline SDWORD DMulScale##s (SDWORD a, SDWORD b, SDWORD c, SDWORD d) \
|
||||
{ \
|
||||
|
@ -163,115 +141,6 @@ __forceinline SDWORD DMulScale32 (SDWORD a, SDWORD b, SDWORD c, SDWORD d)
|
|||
__asm mov eax,edx
|
||||
}
|
||||
|
||||
#define MAKECONSTTMulScale(s) \
|
||||
__forceinline SDWORD TMulScale##s (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f) \
|
||||
{ \
|
||||
__asm mov eax,a \
|
||||
__asm imul b \
|
||||
__asm mov ebx,eax \
|
||||
__asm mov eax,d \
|
||||
__asm mov ecx,edx \
|
||||
__asm imul c \
|
||||
__asm add ebx,eax \
|
||||
__asm mov eax,e \
|
||||
__asm adc ecx,edx \
|
||||
__asm imul f \
|
||||
__asm add eax,ebx \
|
||||
__asm adc edx,ecx \
|
||||
__asm shrd eax,edx,s \
|
||||
}
|
||||
|
||||
MAKECONSTTMulScale(1)
|
||||
MAKECONSTTMulScale(2)
|
||||
MAKECONSTTMulScale(3)
|
||||
MAKECONSTTMulScale(4)
|
||||
MAKECONSTTMulScale(5)
|
||||
MAKECONSTTMulScale(6)
|
||||
MAKECONSTTMulScale(7)
|
||||
MAKECONSTTMulScale(8)
|
||||
MAKECONSTTMulScale(9)
|
||||
MAKECONSTTMulScale(10)
|
||||
MAKECONSTTMulScale(11)
|
||||
MAKECONSTTMulScale(12)
|
||||
MAKECONSTTMulScale(13)
|
||||
MAKECONSTTMulScale(14)
|
||||
MAKECONSTTMulScale(15)
|
||||
MAKECONSTTMulScale(16)
|
||||
MAKECONSTTMulScale(17)
|
||||
MAKECONSTTMulScale(18)
|
||||
MAKECONSTTMulScale(19)
|
||||
MAKECONSTTMulScale(20)
|
||||
MAKECONSTTMulScale(21)
|
||||
MAKECONSTTMulScale(22)
|
||||
MAKECONSTTMulScale(23)
|
||||
MAKECONSTTMulScale(24)
|
||||
MAKECONSTTMulScale(25)
|
||||
MAKECONSTTMulScale(26)
|
||||
MAKECONSTTMulScale(27)
|
||||
MAKECONSTTMulScale(28)
|
||||
MAKECONSTTMulScale(29)
|
||||
MAKECONSTTMulScale(30)
|
||||
MAKECONSTTMulScale(31)
|
||||
#undef MAKECONSTTMulScale
|
||||
|
||||
__forceinline SDWORD TMulScale32 (SDWORD a, SDWORD b, SDWORD c, SDWORD d, SDWORD e, SDWORD f)
|
||||
{
|
||||
__asm mov eax,a
|
||||
__asm imul b
|
||||
__asm mov ebx,eax
|
||||
__asm mov eax,c
|
||||
__asm mov ecx,edx
|
||||
__asm imul d
|
||||
__asm add ebx,eax
|
||||
__asm mov eax,e
|
||||
__asm adc ecx,edx
|
||||
__asm imul f
|
||||
__asm add eax,ebx
|
||||
__asm adc edx,ecx
|
||||
__asm mov eax,edx
|
||||
}
|
||||
|
||||
__forceinline SDWORD BoundMulScale (SDWORD a, SDWORD b, SDWORD c)
|
||||
{
|
||||
__asm mov eax,a
|
||||
__asm imul b
|
||||
__asm mov ebx,edx
|
||||
__asm mov ecx,c
|
||||
__asm shrd eax,edx,cl
|
||||
__asm sar edx,cl
|
||||
__asm xor edx,eax
|
||||
__asm js checkit
|
||||
__asm xor edx,eax
|
||||
__asm jz skipboundit
|
||||
__asm cmp edx,0xffffffff
|
||||
__asm je skipboundit
|
||||
checkit:
|
||||
__asm mov eax,ebx
|
||||
__asm sar eax,31
|
||||
__asm xor eax,0x7fffffff
|
||||
skipboundit:
|
||||
;
|
||||
}
|
||||
|
||||
__forceinline SDWORD DivScale (SDWORD a, SDWORD b, SDWORD c)
|
||||
{
|
||||
__asm mov eax,a
|
||||
__asm mov ecx,c
|
||||
__asm shl eax,cl
|
||||
__asm mov edx,a
|
||||
__asm neg cl
|
||||
__asm sar edx,cl
|
||||
__asm idiv b
|
||||
}
|
||||
|
||||
__forceinline SDWORD DivScale1 (SDWORD a, SDWORD b)
|
||||
{
|
||||
__asm mov eax,a
|
||||
__asm add eax,eax
|
||||
__asm sbb edx,edx
|
||||
__asm idiv b
|
||||
}
|
||||
|
||||
#define MAKECONSTDivScale(s) \
|
||||
__forceinline SDWORD DivScale##s (SDWORD a, SDWORD b) \
|
||||
{ \
|
||||
|
@ -314,11 +183,4 @@ MAKECONSTDivScale(30)
|
|||
MAKECONSTDivScale(31)
|
||||
#undef MAKECONSTDivScale
|
||||
|
||||
__forceinline SDWORD DivScale32 (SDWORD a, SDWORD b)
|
||||
{
|
||||
__asm mov edx,a
|
||||
__asm xor eax,eax
|
||||
__asm idiv b
|
||||
}
|
||||
|
||||
#pragma warning (default: 4035)
|
||||
|
|
Loading…
Reference in a new issue