aboutsummaryrefslogtreecommitdiff
path: root/mp/src/mathlib
diff options
context:
space:
mode:
Diffstat (limited to 'mp/src/mathlib')
-rw-r--r--mp/src/mathlib/IceKey.cpp38
-rw-r--r--mp/src/mathlib/color_conversion.cpp8
-rw-r--r--mp/src/mathlib/mathlib_base.cpp2
-rw-r--r--mp/src/mathlib/sse.cpp10
-rw-r--r--mp/src/mathlib/sse.h4
-rw-r--r--mp/src/mathlib/ssenoise.cpp4
-rw-r--r--mp/src/mathlib/vmatrix.cpp2
7 files changed, 43 insertions, 25 deletions
diff --git a/mp/src/mathlib/IceKey.cpp b/mp/src/mathlib/IceKey.cpp
index e739ce6f..c03c72fe 100644
--- a/mp/src/mathlib/IceKey.cpp
+++ b/mp/src/mathlib/IceKey.cpp
@@ -60,11 +60,11 @@ static const int ice_keyrot[16] = {
static unsigned int
gf_mult (
- register unsigned int a,
- register unsigned int b,
- register unsigned int m
+ unsigned int a,
+ unsigned int b,
+ unsigned int m
) {
- register unsigned int res = 0;
+ unsigned int res = 0;
while (b) {
if (b & 1)
@@ -88,10 +88,10 @@ gf_mult (
static unsigned long
gf_exp7 (
- register unsigned int b,
+ unsigned int b,
unsigned int m
) {
- register unsigned int x;
+ unsigned int x;
if (b == 0)
return (0);
@@ -109,10 +109,10 @@ gf_exp7 (
static unsigned long
ice_perm32 (
- register unsigned long x
+ unsigned long x
) {
- register unsigned long res = 0;
- register const unsigned long *pbox = ice_pbox;
+ unsigned long res = 0;
+ const unsigned long *pbox = ice_pbox;
while (x) {
if (x & 1)
@@ -133,7 +133,7 @@ ice_perm32 (
static void
ice_sboxes_init (void)
{
- register int i;
+ int i;
for (i=0; i<1024; i++) {
int col = (i >> 1) & 0xff;
@@ -202,7 +202,7 @@ IceKey::~IceKey ()
static unsigned long
ice_f (
- register unsigned long p,
+ unsigned long p,
const IceSubkey *sk
) {
unsigned long tl, tr; /* Expanded 40-bit values */
@@ -240,8 +240,8 @@ IceKey::encrypt (
unsigned char *ctext
) const
{
- register int i;
- register unsigned long l, r;
+ int i;
+ unsigned long l, r;
l = (((unsigned long) ptext[0]) << 24)
| (((unsigned long) ptext[1]) << 16)
@@ -275,8 +275,8 @@ IceKey::decrypt (
unsigned char *ptext
) const
{
- register int i;
- register unsigned long l, r;
+ int i;
+ unsigned long l, r;
l = (((unsigned long) ctext[0]) << 24)
| (((unsigned long) ctext[1]) << 16)
@@ -313,20 +313,20 @@ IceKey::scheduleBuild (
int i;
for (i=0; i<8; i++) {
- register int j;
- register int kr = keyrot[i];
+ int j;
+ int kr = keyrot[i];
IceSubkey *isk = &_keysched[n + i];
for (j=0; j<3; j++)
isk->val[j] = 0;
for (j=0; j<15; j++) {
- register int k;
+ int k;
unsigned long *curr_sk = &isk->val[j % 3];
for (k=0; k<4; k++) {
unsigned short *curr_kb = &kb[(kr + k) & 3];
- register int bit = *curr_kb & 1;
+ int bit = *curr_kb & 1;
*curr_sk = (*curr_sk << 1) | bit;
*curr_kb = (*curr_kb >> 1) | ((bit ^ 1) << 15);
diff --git a/mp/src/mathlib/color_conversion.cpp b/mp/src/mathlib/color_conversion.cpp
index c3125258..c3dbaf25 100644
--- a/mp/src/mathlib/color_conversion.cpp
+++ b/mp/src/mathlib/color_conversion.cpp
@@ -609,10 +609,10 @@ void VectorToColorRGBExp32( const Vector& vin, ColorRGBExp32 &c )
scalar = *reinterpret_cast<float *>(&fbits);
}
- // we should never need to clamp:
- Assert(vin.x * scalar <= 255.0f &&
- vin.y * scalar <= 255.0f &&
- vin.z * scalar <= 255.0f);
+ // We can totally wind up above 255 and that's okay--but above 256 would be right out.
+ Assert(vin.x * scalar < 256.0f &&
+ vin.y * scalar < 256.0f &&
+ vin.z * scalar < 256.0f);
// This awful construction is necessary to prevent VC2005 from using the
// fldcw/fnstcw control words around every float-to-unsigned-char operation.
diff --git a/mp/src/mathlib/mathlib_base.cpp b/mp/src/mathlib/mathlib_base.cpp
index 15c51963..dee2f28e 100644
--- a/mp/src/mathlib/mathlib_base.cpp
+++ b/mp/src/mathlib/mathlib_base.cpp
@@ -3388,7 +3388,7 @@ void MathLib_Init( float gamma, float texGamma, float brightness, int overbright
{
s_bSSE2Enabled = false;
}
-#endif
+#endif // !_X360
s_bMathlibInitialized = true;
diff --git a/mp/src/mathlib/sse.cpp b/mp/src/mathlib/sse.cpp
index 2260550b..7240e5ed 100644
--- a/mp/src/mathlib/sse.cpp
+++ b/mp/src/mathlib/sse.cpp
@@ -204,7 +204,9 @@ float FASTCALL _SSE_VectorNormalize (Vector& vec)
#endif
float *v = &vec[0];
+#ifdef _WIN32
float *r = &result[0];
+#endif
float radius = 0.f;
// Blah, get rid of these comparisons ... in reality, if you have all 3 as zero, it shouldn't
@@ -740,6 +742,7 @@ float _SSE_cos( float x )
//-----------------------------------------------------------------------------
// SSE2 implementations of optimized routines:
//-----------------------------------------------------------------------------
+#ifdef PLATFORM_WINDOWS_PC32
void _SSE2_SinCos(float x, float* s, float* c) // any x
{
#ifdef _WIN32
@@ -825,7 +828,9 @@ void _SSE2_SinCos(float x, float* s, float* c) // any x
#error "Not Implemented"
#endif
}
+#endif // PLATFORM_WINDOWS_PC32
+#ifdef PLATFORM_WINDOWS_PC32
float _SSE2_cos(float x)
{
#ifdef _WIN32
@@ -883,7 +888,9 @@ float _SSE2_cos(float x)
return x;
}
+#endif // PLATFORM_WINDOWS_PC32
+#if 0
// SSE Version of VectorTransform
void VectorTransformSSE(const float *in1, const matrix3x4_t& in2, float *out1)
{
@@ -941,7 +948,9 @@ void VectorTransformSSE(const float *in1, const matrix3x4_t& in2, float *out1)
#error "Not Implemented"
#endif
}
+#endif
+#if 0
void VectorRotateSSE( const float *in1, const matrix3x4_t& in2, float *out1 )
{
Assert( s_bMathlibInitialized );
@@ -995,6 +1004,7 @@ void VectorRotateSSE( const float *in1, const matrix3x4_t& in2, float *out1 )
#error "Not Implemented"
#endif
}
+#endif
#ifdef _WIN32
void _declspec(naked) _SSE_VectorMA( const float *start, float scale, const float *direction, float *dest )
diff --git a/mp/src/mathlib/sse.h b/mp/src/mathlib/sse.h
index 72de1d3b..1b49c50c 100644
--- a/mp/src/mathlib/sse.h
+++ b/mp/src/mathlib/sse.h
@@ -15,9 +15,13 @@ void FASTCALL _SSE_VectorNormalizeFast(Vector& vec);
float _SSE_InvRSquared(const float* v);
void _SSE_SinCos(float x, float* s, float* c);
float _SSE_cos( float x);
+#ifdef PLATFORM_WINDOWS_PC32
void _SSE2_SinCos(float x, float* s, float* c);
float _SSE2_cos(float x);
+#endif
+#if 0
void VectorTransformSSE(const float *in1, const matrix3x4_t& in2, float *out1);
void VectorRotateSSE( const float *in1, const matrix3x4_t& in2, float *out1 );
+#endif
#endif // _SSE_H
diff --git a/mp/src/mathlib/ssenoise.cpp b/mp/src/mathlib/ssenoise.cpp
index 244a1e59..6ead1c8d 100644
--- a/mp/src/mathlib/ssenoise.cpp
+++ b/mp/src/mathlib/ssenoise.cpp
@@ -30,6 +30,10 @@ static ALIGN16 int32 idx_mask[4]= {0xffff, 0xffff, 0xffff, 0xffff};
// returns 0..1
static inline float GetLatticePointValue( int idx_x, int idx_y, int idx_z )
{
+ NOTE_UNUSED(perm_d);
+ NOTE_UNUSED(impulse_ycoords);
+ NOTE_UNUSED(impulse_zcoords);
+
int ret_idx = perm_a[idx_x & 0xff];
ret_idx = perm_b[( idx_y + ret_idx ) & 0xff];
ret_idx = perm_c[( idx_z + ret_idx ) & 0xff];
diff --git a/mp/src/mathlib/vmatrix.cpp b/mp/src/mathlib/vmatrix.cpp
index e99fae2a..01a987b4 100644
--- a/mp/src/mathlib/vmatrix.cpp
+++ b/mp/src/mathlib/vmatrix.cpp
@@ -955,7 +955,7 @@ void MatrixBuildTranslation( VMatrix& dst, const Vector &translation )
//-----------------------------------------------------------------------------
void MatrixBuildRotationAboutAxis( VMatrix &dst, const Vector &vAxisOfRot, float angleDegrees )
{
- MatrixBuildRotationAboutAxis( vAxisOfRot, angleDegrees, dst.As3x4() );
+ MatrixBuildRotationAboutAxis( vAxisOfRot, angleDegrees, const_cast< matrix3x4_t &> ( dst.As3x4() ) );
dst[3][0] = 0;
dst[3][1] = 0;
dst[3][2] = 0;