summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2016-11-16 10:56:05 -0500
committerNat Goodspeed <nat@lindenlab.com>2016-11-16 10:56:05 -0500
commit934b94e74a94f13521b67bdd016a5b591e16fe13 (patch)
treed181a0811e1f6773f0a4bd44c72dae48fae45a4e /indra/llmath
parentaf349febb3275bc1d75026f1f022595b50abda24 (diff)
parent0c8556921d05a356afd4014b966ee8c0e1002e36 (diff)
DRTVWR-418: pull in new viewer-release via viewer64
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llmath.h4
-rw-r--r--indra/llmath/llsimdmath.h2
-rw-r--r--indra/llmath/v4coloru.h32
3 files changed, 27 insertions, 11 deletions
diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index 93b9f22b25..b66a3c63d6 100644
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -153,7 +153,7 @@ inline F64 llabs(const F64 a)
inline S32 lltrunc( F32 f )
{
-#if LL_WINDOWS && !defined( __INTEL_COMPILER )
+#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined( _M_AMD64 )
// Avoids changing the floating point control word.
// Add or subtract 0.5 - epsilon and then round
const static U32 zpfp[] = { 0xBEFFFFFF, 0x3EFFFFFF };
@@ -179,7 +179,7 @@ inline S32 lltrunc( F64 f )
inline S32 llfloor( F32 f )
{
-#if LL_WINDOWS && !defined( __INTEL_COMPILER )
+#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined( _M_AMD64 )
// Avoids changing the floating point control word.
// Accurate (unlike Stereopsis version) for all values between S32_MIN and S32_MAX and slightly faster than Stereopsis version.
// Add -(0.5 - epsilon) and then round
diff --git a/indra/llmath/llsimdmath.h b/indra/llmath/llsimdmath.h
index cebd2ace7d..9f078ec1ef 100644
--- a/indra/llmath/llsimdmath.h
+++ b/indra/llmath/llsimdmath.h
@@ -31,7 +31,7 @@
#error "Please include llmath.h before this file."
#endif
-#if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 ) )
+#if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 && !_M_AMD64 ) )
#error SSE2 not enabled. LLVector4a and related class will not compile.
#endif
diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h
index fddad34978..704ce852d9 100644
--- a/indra/llmath/v4coloru.h
+++ b/indra/llmath/v4coloru.h
@@ -47,14 +47,7 @@ class LLColor4U
{
public:
- union
- {
- U8 mV[LENGTHOFCOLOR4U];
- U32 mAll;
- LLColor4* mSources;
- LLColor4U* mSourcesU;
- };
-
+ U8 mV[LENGTHOFCOLOR4U];
LLColor4U(); // Initializes LLColor4U to (0, 0, 0, 1)
LLColor4U(U8 r, U8 g, U8 b); // Initializes LLColor4U to (r, g, b, 1)
@@ -132,6 +125,9 @@ public:
return LLColor4(*this);
}
+ U32 asRGBA() const;
+ void fromRGBA( U32 aVal );
+
static LLColor4U white;
static LLColor4U black;
static LLColor4U red;
@@ -565,6 +561,26 @@ void LLColor4U::setVecScaleClamp(const LLColor3& color)
mV[3] = 255;
}
+inline U32 LLColor4U::asRGBA() const
+{
+ // Little endian: values are swapped in memory. The original code access the array like a U32, so we need to swap here
+
+ return (mV[3] << 24) | (mV[2] << 16) | (mV[1] << 8) | mV[0];
+}
+
+inline void LLColor4U::fromRGBA( U32 aVal )
+{
+ // Little endian: values are swapped in memory. The original code access the array like a U32, so we need to swap here
+
+ mV[ 0 ] = aVal & 0xFF;
+ aVal >>= 8;
+ mV[ 1 ] = aVal & 0xFF;
+ aVal >>= 8;
+ mV[ 2 ] = aVal & 0xFF;
+ aVal >>= 8;
+ mV[ 3 ] = aVal & 0xFF;
+}
+
#endif