Added most recent version of unmodified HL2 SDK for Orange Box engine

This commit is contained in:
Scott Ehlert committed 2008-09-15 01:07:45 -05:00
commit 055f5cd168
2907 files changed
+1271781

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=====================================================================================//
#include "mathlib/ssemath.h"
fltx4 Pow_FixedPoint_Exponent_SIMD( const fltx4 & x, int exponent)
{
fltx4 rslt=Four_Ones; // x^0=1.0
int xp=abs(exponent);
if (xp & 3) // fraction present?
{
fltx4 sq_rt=SqrtEstSIMD(x);
if (xp & 1) // .25?
rslt=SqrtEstSIMD(sq_rt); // x^.25
if (xp & 2)
rslt=MulSIMD(rslt,sq_rt);
}
xp>>=2; // strip fraction
fltx4 curpower=x; // curpower iterates through x,x^2,x^4,x^8,x^16...
while(1)
{
if (xp & 1)
rslt=MulSIMD(rslt,curpower);
xp>>=1;
if (xp)
curpower=MulSIMD(curpower,curpower);
else
break;
}
if (exponent<0)
return ReciprocalEstSIMD(rslt); // pow(x,-b)=1/pow(x,b)
else
return rslt;
}