diff options
Diffstat (limited to 'linden/indra/llmath')
-rw-r--r-- | linden/indra/llmath/llcrc.cpp | 19 | ||||
-rw-r--r-- | linden/indra/llmath/llcrc.h | 2 | ||||
-rw-r--r-- | linden/indra/llmath/llmath.h | 3 | ||||
-rw-r--r-- | linden/indra/llmath/llmath.vcproj | 12 | ||||
-rw-r--r-- | linden/indra/llmath/llmath_vc8.vcproj | 16 | ||||
-rw-r--r-- | linden/indra/llmath/llmd5.cpp | 111 | ||||
-rw-r--r-- | linden/indra/llmath/llmd5.h | 17 | ||||
-rw-r--r-- | linden/indra/llmath/lloctree.h | 68 | ||||
-rw-r--r-- | linden/indra/llmath/llrect.h | 47 | ||||
-rw-r--r-- | linden/indra/llmath/lltreenode.h | 22 | ||||
-rw-r--r-- | linden/indra/llmath/lluuid.cpp | 4 | ||||
-rw-r--r-- | linden/indra/llmath/llv4math.h | 143 | ||||
-rw-r--r-- | linden/indra/llmath/llv4matrix3.h | 222 | ||||
-rw-r--r-- | linden/indra/llmath/llv4matrix4.h | 251 | ||||
-rw-r--r-- | linden/indra/llmath/llv4vector3.h | 82 | ||||
-rw-r--r-- | linden/indra/llmath/llvolume.cpp | 18 | ||||
-rw-r--r-- | linden/indra/llmath/llvolume.h | 2 |
17 files changed, 869 insertions, 170 deletions
diff --git a/linden/indra/llmath/llcrc.cpp b/linden/indra/llmath/llcrc.cpp index cc0f955..5b3ab4b 100644 --- a/linden/indra/llmath/llcrc.cpp +++ b/linden/indra/llmath/llcrc.cpp | |||
@@ -154,11 +154,11 @@ void LLCRC::update(U8 next_byte) | |||
154 | mCurrent = UPDC32(next_byte, mCurrent); | 154 | mCurrent = UPDC32(next_byte, mCurrent); |
155 | } | 155 | } |
156 | 156 | ||
157 | void LLCRC::update(const U8* buffer, U32 buffer_size) | 157 | void LLCRC::update(const U8* buffer, size_t buffer_size) |
158 | { | 158 | { |
159 | for ( ; buffer_size; --buffer_size, ++buffer) | 159 | for (size_t i = 0; i < buffer_size; i++) |
160 | { | 160 | { |
161 | mCurrent = UPDC32(*buffer, mCurrent); | 161 | mCurrent = UPDC32(buffer[i], mCurrent); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
@@ -175,17 +175,24 @@ void LLCRC::update(const char* filename) | |||
175 | if (fp) | 175 | if (fp) |
176 | { | 176 | { |
177 | fseek(fp, 0, SEEK_END); | 177 | fseek(fp, 0, SEEK_END); |
178 | U32 size = ftell(fp); | 178 | long size = ftell(fp); |
179 | 179 | ||
180 | fseek(fp, 0, SEEK_SET); | 180 | fseek(fp, 0, SEEK_SET); |
181 | 181 | ||
182 | if (size > 0) | 182 | if (size > 0) |
183 | { | 183 | { |
184 | U8* data = new U8[size]; | 184 | U8* data = new U8[size]; |
185 | fread(data, size, 1, fp); | 185 | size_t nread; |
186 | |||
187 | nread = fread(data, 1, size, fp); | ||
186 | fclose(fp); | 188 | fclose(fp); |
189 | |||
190 | if (nread < (size_t) size) | ||
191 | { | ||
192 | llwarns << "Short read on " << filename << llendl; | ||
193 | } | ||
187 | 194 | ||
188 | update(data, size); | 195 | update(data, nread); |
189 | delete[] data; | 196 | delete[] data; |
190 | } | 197 | } |
191 | } | 198 | } |
diff --git a/linden/indra/llmath/llcrc.h b/linden/indra/llmath/llcrc.h index 06ddac2..9f71fcc 100644 --- a/linden/indra/llmath/llcrc.h +++ b/linden/indra/llmath/llcrc.h | |||
@@ -56,7 +56,7 @@ public: | |||
56 | 56 | ||
57 | U32 getCRC() const; | 57 | U32 getCRC() const; |
58 | void update(U8 next_byte); | 58 | void update(U8 next_byte); |
59 | void update(const U8* buffer, U32 buffer_size); | 59 | void update(const U8* buffer, size_t buffer_size); |
60 | void update(const char *filename); | 60 | void update(const char *filename); |
61 | 61 | ||
62 | #ifdef _DEBUG | 62 | #ifdef _DEBUG |
diff --git a/linden/indra/llmath/llmath.h b/linden/indra/llmath/llmath.h index dd44e0c..9be2524 100644 --- a/linden/indra/llmath/llmath.h +++ b/linden/indra/llmath/llmath.h | |||
@@ -42,6 +42,9 @@ | |||
42 | #elif (LL_LINUX && __GNUC__ <= 2) | 42 | #elif (LL_LINUX && __GNUC__ <= 2) |
43 | #define llisnan(val) isnan(val) | 43 | #define llisnan(val) isnan(val) |
44 | #define llfinite(val) isfinite(val) | 44 | #define llfinite(val) isfinite(val) |
45 | #elif LL_SOLARIS | ||
46 | #define llisnan(val) isnan(val) | ||
47 | #define llfinite(val) (val <= std::numeric_limits<double>::max()) | ||
45 | #else | 48 | #else |
46 | #define llisnan(val) std::isnan(val) | 49 | #define llisnan(val) std::isnan(val) |
47 | #define llfinite(val) std::isfinite(val) | 50 | #define llfinite(val) std::isfinite(val) |
diff --git a/linden/indra/llmath/llmath.vcproj b/linden/indra/llmath/llmath.vcproj index 4876065..bdc8ded 100644 --- a/linden/indra/llmath/llmath.vcproj +++ b/linden/indra/llmath/llmath.vcproj | |||
@@ -272,6 +272,18 @@ | |||
272 | RelativePath=".\lluuid.h"> | 272 | RelativePath=".\lluuid.h"> |
273 | </File> | 273 | </File> |
274 | <File | 274 | <File |
275 | RelativePath=".\llv4math.h"> | ||
276 | </File> | ||
277 | <File | ||
278 | RelativePath=".\llv4matrix3.h"> | ||
279 | </File> | ||
280 | <File | ||
281 | RelativePath=".\llv4matrix4.h"> | ||
282 | </File> | ||
283 | <File | ||
284 | RelativePath=".\llv4vector3.h"> | ||
285 | </File> | ||
286 | <File | ||
275 | RelativePath=".\llvolume.h"> | 287 | RelativePath=".\llvolume.h"> |
276 | </File> | 288 | </File> |
277 | <File | 289 | <File |
diff --git a/linden/indra/llmath/llmath_vc8.vcproj b/linden/indra/llmath/llmath_vc8.vcproj index ea23702..03d75c3 100644 --- a/linden/indra/llmath/llmath_vc8.vcproj +++ b/linden/indra/llmath/llmath_vc8.vcproj | |||
@@ -389,6 +389,22 @@ | |||
389 | > | 389 | > |
390 | </File> | 390 | </File> |
391 | <File | 391 | <File |
392 | RelativePath=".\llv4math.h" | ||
393 | > | ||
394 | </File> | ||
395 | <File | ||
396 | RelativePath=".\llv4matrix3.h" | ||
397 | > | ||
398 | </File> | ||
399 | <File | ||
400 | RelativePath=".\llv4matrix4.h" | ||
401 | > | ||
402 | </File> | ||
403 | <File | ||
404 | RelativePath=".\llv4vector3.h" | ||
405 | > | ||
406 | </File> | ||
407 | <File | ||
392 | RelativePath=".\llvolume.h" | 408 | RelativePath=".\llvolume.h" |
393 | > | 409 | > |
394 | </File> | 410 | </File> |
diff --git a/linden/indra/llmath/llmd5.cpp b/linden/indra/llmath/llmd5.cpp index aad4617..1a8630c 100644 --- a/linden/indra/llmath/llmd5.cpp +++ b/linden/indra/llmath/llmd5.cpp | |||
@@ -83,6 +83,9 @@ documentation and/or software. | |||
83 | #include <fstream> | 83 | #include <fstream> |
84 | #include <iostream> | 84 | #include <iostream> |
85 | 85 | ||
86 | // how many bytes to grab at a time when checking files | ||
87 | const int LLMD5::BLOCK_LEN = 4096; | ||
88 | |||
86 | 89 | ||
87 | // LLMD5 simple initialization method | 90 | // LLMD5 simple initialization method |
88 | 91 | ||
@@ -156,10 +159,10 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) { | |||
156 | 159 | ||
157 | void LLMD5::update(FILE* file){ | 160 | void LLMD5::update(FILE* file){ |
158 | 161 | ||
159 | unsigned char buffer[1024]; /* Flawfinder: ignore */ | 162 | unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ |
160 | int len; | 163 | int len; |
161 | 164 | ||
162 | while ( (len=(int)fread(buffer, 1, 1024, file)) ) | 165 | while ( (len=(int)fread(buffer, 1, BLOCK_LEN, file)) ) |
163 | update(buffer, len); | 166 | update(buffer, len); |
164 | 167 | ||
165 | fclose (file); | 168 | fclose (file); |
@@ -176,11 +179,11 @@ void LLMD5::update(FILE* file){ | |||
176 | 179 | ||
177 | void LLMD5::update(std::istream& stream){ | 180 | void LLMD5::update(std::istream& stream){ |
178 | 181 | ||
179 | unsigned char buffer[1024]; /* Flawfinder: ignore */ | 182 | unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ |
180 | int len; | 183 | int len; |
181 | 184 | ||
182 | while (stream.good()){ | 185 | while (stream.good()){ |
183 | stream.read( (char*)buffer, 1024); /* Flawfinder: ignore */ // note that return value of read is unusable. | 186 | stream.read( (char*)buffer, BLOCK_LEN); /* Flawfinder: ignore */ // note that return value of read is unusable. |
184 | len=stream.gcount(); | 187 | len=stream.gcount(); |
185 | update(buffer, len); | 188 | update(buffer, len); |
186 | } | 189 | } |
@@ -366,11 +369,48 @@ void LLMD5::init(){ | |||
366 | #define S43 15 | 369 | #define S43 15 |
367 | #define S44 21 | 370 | #define S44 21 |
368 | 371 | ||
372 | // #defines are faster then inline, etc because the compiler is not required to inline. | ||
373 | // Timing tests prove that this works ~40% faster on win with msvc++2k3 over using static inline. | ||
374 | |||
375 | /* F, G, H and I are basic MD5 functions. | ||
376 | */ | ||
377 | #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) | ||
378 | #define G(x, y, z) (((x) & (z)) | ((y) & (~z))) | ||
379 | #define H(x, y, z) ((x) ^ (y) ^ (z)) | ||
380 | #define I(x, y, z) ((y) ^ ((x) | (~z))) | ||
381 | |||
382 | /* ROTATE_LEFT rotates x left n bits. | ||
383 | */ | ||
384 | #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) | ||
385 | |||
386 | /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. | ||
387 | Rotation is separate from addition to prevent recomputation. | ||
388 | */ | ||
389 | #define FF(a, b, c, d, x, s, ac) { \ | ||
390 | (a) += F ((b), (c), (d)) + (x) + (U32)(ac); \ | ||
391 | (a) = ROTATE_LEFT ((a), (s)); \ | ||
392 | (a) += (b); \ | ||
393 | } | ||
394 | #define GG(a, b, c, d, x, s, ac) { \ | ||
395 | (a) += G ((b), (c), (d)) + (x) + (U32)(ac); \ | ||
396 | (a) = ROTATE_LEFT ((a), (s)); \ | ||
397 | (a) += (b); \ | ||
398 | } | ||
399 | #define HH(a, b, c, d, x, s, ac) { \ | ||
400 | (a) += H ((b), (c), (d)) + (x) + (U32)(ac); \ | ||
401 | (a) = ROTATE_LEFT ((a), (s)); \ | ||
402 | (a) += (b); \ | ||
403 | } | ||
404 | #define II(a, b, c, d, x, s, ac) { \ | ||
405 | (a) += I ((b), (c), (d)) + (x) + (U32)(ac); \ | ||
406 | (a) = ROTATE_LEFT ((a), (s)); \ | ||
407 | (a) += (b); \ | ||
408 | } | ||
369 | 409 | ||
370 | 410 | ||
371 | 411 | ||
372 | // LLMD5 basic transformation. Transforms state based on block. | 412 | // LLMD5 basic transformation. Transforms state based on block. |
373 | void LLMD5::transform (const uint1 block[64]){ | 413 | void LLMD5::transform (const U8 block[64]){ |
374 | 414 | ||
375 | uint4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; | 415 | uint4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; |
376 | 416 | ||
@@ -489,64 +529,3 @@ void LLMD5::decode (uint4 *output, const uint1 *input, const uint4 len){ | |||
489 | output[i] = ((uint4)input[j]) | (((uint4)input[j+1]) << 8) | | 529 | output[i] = ((uint4)input[j]) | (((uint4)input[j+1]) << 8) | |
490 | (((uint4)input[j+2]) << 16) | (((uint4)input[j+3]) << 24); | 530 | (((uint4)input[j+2]) << 16) | (((uint4)input[j+3]) << 24); |
491 | } | 531 | } |
492 | |||
493 | |||
494 | |||
495 | |||
496 | |||
497 | // ROTATE_LEFT rotates x left n bits. | ||
498 | |||
499 | inline unsigned int LLMD5::rotate_left (uint4 x, uint4 n){ | ||
500 | return (x << n) | (x >> (32-n)) ; | ||
501 | } | ||
502 | |||
503 | |||
504 | |||
505 | |||
506 | // F, G, H and I are basic MD5 functions. | ||
507 | |||
508 | inline unsigned int LLMD5::F (uint4 x, uint4 y, uint4 z){ | ||
509 | return (x & y) | (~x & z); | ||
510 | } | ||
511 | |||
512 | inline unsigned int LLMD5::G (uint4 x, uint4 y, uint4 z){ | ||
513 | return (x & z) | (y & ~z); | ||
514 | } | ||
515 | |||
516 | inline unsigned int LLMD5::H (uint4 x, uint4 y, uint4 z){ | ||
517 | return x ^ y ^ z; | ||
518 | } | ||
519 | |||
520 | inline unsigned int LLMD5::I (uint4 x, uint4 y, uint4 z){ | ||
521 | return y ^ (x | ~z); | ||
522 | } | ||
523 | |||
524 | |||
525 | |||
526 | // FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. | ||
527 | // Rotation is separate from addition to prevent recomputation. | ||
528 | |||
529 | |||
530 | inline void LLMD5::FF(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, | ||
531 | uint4 s, uint4 ac){ | ||
532 | a += F(b, c, d) + x + ac; | ||
533 | a = rotate_left (a, s) +b; | ||
534 | } | ||
535 | |||
536 | inline void LLMD5::GG(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, | ||
537 | uint4 s, uint4 ac){ | ||
538 | a += G(b, c, d) + x + ac; | ||
539 | a = rotate_left (a, s) +b; | ||
540 | } | ||
541 | |||
542 | inline void LLMD5::HH(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, | ||
543 | uint4 s, uint4 ac){ | ||
544 | a += H(b, c, d) + x + ac; | ||
545 | a = rotate_left (a, s) +b; | ||
546 | } | ||
547 | |||
548 | inline void LLMD5::II(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, | ||
549 | uint4 s, uint4 ac){ | ||
550 | a += I(b, c, d) + x + ac; | ||
551 | a = rotate_left (a, s) +b; | ||
552 | } | ||
diff --git a/linden/indra/llmath/llmd5.h b/linden/indra/llmath/llmd5.h index 20c32ed..5df98bf 100644 --- a/linden/indra/llmath/llmd5.h +++ b/linden/indra/llmath/llmd5.h | |||
@@ -85,6 +85,9 @@ class LLMD5 { | |||
85 | typedef unsigned short int uint2; // assumes short integer is 2 words long | 85 | typedef unsigned short int uint2; // assumes short integer is 2 words long |
86 | typedef unsigned char uint1; // assumes char is 1 word long | 86 | typedef unsigned char uint1; // assumes char is 1 word long |
87 | 87 | ||
88 | // how many bytes to grab at a time when checking files | ||
89 | static const int BLOCK_LEN; | ||
90 | |||
88 | public: | 91 | public: |
89 | // methods for controlled operation: | 92 | // methods for controlled operation: |
90 | LLMD5 (); // simple initializer | 93 | LLMD5 (); // simple initializer |
@@ -125,20 +128,6 @@ private: | |||
125 | static void encode (uint1 *dest, const uint4 *src, const uint4 length); | 128 | static void encode (uint1 *dest, const uint4 *src, const uint4 length); |
126 | static void decode (uint4 *dest, const uint1 *src, const uint4 length); | 129 | static void decode (uint4 *dest, const uint1 *src, const uint4 length); |
127 | 130 | ||
128 | static inline uint4 rotate_left (uint4 x, uint4 n); | ||
129 | static inline uint4 F (uint4 x, uint4 y, uint4 z); | ||
130 | static inline uint4 G (uint4 x, uint4 y, uint4 z); | ||
131 | static inline uint4 H (uint4 x, uint4 y, uint4 z); | ||
132 | static inline uint4 I (uint4 x, uint4 y, uint4 z); | ||
133 | static inline void FF (uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, | ||
134 | uint4 s, uint4 ac); | ||
135 | static inline void GG (uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, | ||
136 | uint4 s, uint4 ac); | ||
137 | static inline void HH (uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, | ||
138 | uint4 s, uint4 ac); | ||
139 | static inline void II (uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, | ||
140 | uint4 s, uint4 ac); | ||
141 | |||
142 | }; | 131 | }; |
143 | 132 | ||
144 | #endif // LL_LLMD5_H | 133 | #endif // LL_LLMD5_H |
diff --git a/linden/indra/llmath/lloctree.h b/linden/indra/llmath/lloctree.h index 004b0a2..2395f0f 100644 --- a/linden/indra/llmath/lloctree.h +++ b/linden/indra/llmath/lloctree.h | |||
@@ -95,34 +95,34 @@ public: | |||
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
98 | virtual ~LLOctreeNode() { BaseType::destroyListeners(); delete this->mState; } | 98 | ~LLOctreeNode() { BaseType::destroyListeners(); delete this->mState; } |
99 | 99 | ||
100 | virtual const BaseType* getParent() const { return mParent; } | 100 | inline const BaseType* getParent() const { return mParent; } |
101 | virtual void setParent(BaseType* parent) { mParent = (oct_node*) parent; } | 101 | inline void setParent(BaseType* parent) { mParent = (oct_node*) parent; } |
102 | virtual const LLVector3d& getCenter() const { return mCenter; } | 102 | inline const LLVector3d& getCenter() const { return mCenter; } |
103 | virtual const LLVector3d& getSize() const { return mSize; } | 103 | inline const LLVector3d& getSize() const { return mSize; } |
104 | virtual void setCenter(LLVector3d center) { mCenter = center; } | 104 | inline void setCenter(LLVector3d center) { mCenter = center; } |
105 | virtual void setSize(LLVector3d size) { mSize = size; } | 105 | inline void setSize(LLVector3d size) { mSize = size; } |
106 | virtual bool balance() { return getOctState()->balance(); } | 106 | inline bool balance() { return getOctState()->balance(); } |
107 | virtual void validate() { getOctState()->validate(); } | 107 | inline void validate() { getOctState()->validate(); } |
108 | virtual U32 getChildCount() const { return getOctState()->getChildCount(); } | 108 | inline U32 getChildCount() const { return getOctState()->getChildCount(); } |
109 | virtual oct_node* getChild(U32 index) { return getOctState()->getChild(index); } | 109 | inline oct_node* getChild(U32 index) { return getOctState()->getChild(index); } |
110 | virtual const oct_node* getChild(U32 index) const { return getOctState()->getChild(index); } | 110 | inline const oct_node* getChild(U32 index) const { return getOctState()->getChild(index); } |
111 | virtual U32 getElementCount() const { return getOctState()->getElementCount(); } | 111 | inline U32 getElementCount() const { return getOctState()->getElementCount(); } |
112 | virtual void removeByAddress(T* data) { getOctState()->removeByAddress(data); } | 112 | inline void removeByAddress(T* data) { getOctState()->removeByAddress(data); } |
113 | virtual bool hasLeafState() const { return getOctState()->isLeaf(); } | 113 | inline bool hasLeafState() const { return getOctState()->isLeaf(); } |
114 | virtual void destroy() { getOctState()->destroy(); } | 114 | inline void destroy() { getOctState()->destroy(); } |
115 | virtual oct_node* getNodeAt(T* data) { return getNodeAt(data->getPositionGroup(), data->getBinRadius()); } | 115 | inline oct_node* getNodeAt(T* data) { return getNodeAt(data->getPositionGroup(), data->getBinRadius()); } |
116 | virtual oct_node* getNodeAt(const LLVector3d& pos, const F64& rad) { return getOctState()->getNodeAt(pos, rad); } | 116 | inline oct_node* getNodeAt(const LLVector3d& pos, const F64& rad) { return getOctState()->getNodeAt(pos, rad); } |
117 | virtual U8 getOctant() const { return mOctant; } | 117 | inline U8 getOctant() const { return mOctant; } |
118 | virtual void setOctant(U8 octant) { mOctant = octant; } | 118 | inline void setOctant(U8 octant) { mOctant = octant; } |
119 | virtual const oct_state* getOctState() const { return (const oct_state*) BaseType::mState; } | 119 | inline const oct_state* getOctState() const { return (const oct_state*) BaseType::mState; } |
120 | virtual oct_state* getOctState() { return (oct_state*) BaseType::mState; } | 120 | inline oct_state* getOctState() { return (oct_state*) BaseType::mState; } |
121 | virtual const oct_node* getOctParent() const { return (const oct_node*) getParent(); } | 121 | inline const oct_node* getOctParent() const { return (const oct_node*) getParent(); } |
122 | virtual oct_node* getOctParent() { return (oct_node*) getParent(); } | 122 | inline oct_node* getOctParent() { return (oct_node*) getParent(); } |
123 | virtual void deleteChild(oct_node* child) { getOctState()->deleteChild(child); } | 123 | inline void deleteChild(oct_node* child) { getOctState()->deleteChild(child); } |
124 | 124 | ||
125 | virtual U8 getOctant(const F64 pos[]) const //get the octant pos is in | 125 | U8 getOctant(const F64 pos[]) const //get the octant pos is in |
126 | { | 126 | { |
127 | U8 ret = 0; | 127 | U8 ret = 0; |
128 | 128 | ||
@@ -142,17 +142,17 @@ public: | |||
142 | return ret; | 142 | return ret; |
143 | } | 143 | } |
144 | 144 | ||
145 | virtual bool isInside(const LLVector3d& pos, const F64& rad) const | 145 | inline bool isInside(const LLVector3d& pos, const F64& rad) const |
146 | { | 146 | { |
147 | return rad <= mSize.mdV[0]*2.0 && isInside(pos); | 147 | return rad <= mSize.mdV[0]*2.0 && isInside(pos); |
148 | } | 148 | } |
149 | 149 | ||
150 | virtual bool isInside(T* data) const | 150 | inline bool isInside(T* data) const |
151 | { | 151 | { |
152 | return isInside(data->getPositionGroup(), data->getBinRadius()); | 152 | return isInside(data->getPositionGroup(), data->getBinRadius()); |
153 | } | 153 | } |
154 | 154 | ||
155 | virtual bool isInside(const LLVector3d& pos) const | 155 | bool isInside(const LLVector3d& pos) const |
156 | { | 156 | { |
157 | const F64& x = pos.mdV[0]; | 157 | const F64& x = pos.mdV[0]; |
158 | const F64& y = pos.mdV[1]; | 158 | const F64& y = pos.mdV[1]; |
@@ -168,7 +168,7 @@ public: | |||
168 | return true; | 168 | return true; |
169 | } | 169 | } |
170 | 170 | ||
171 | virtual void updateMinMax() | 171 | void updateMinMax() |
172 | { | 172 | { |
173 | for (U32 i = 0; i < 3; i++) | 173 | for (U32 i = 0; i < 3; i++) |
174 | { | 174 | { |
@@ -178,12 +178,12 @@ public: | |||
178 | } | 178 | } |
179 | } | 179 | } |
180 | 180 | ||
181 | virtual oct_listener* getOctListener(U32 index) | 181 | inline oct_listener* getOctListener(U32 index) |
182 | { | 182 | { |
183 | return (oct_listener*) BaseType::getListener(index); | 183 | return (oct_listener*) BaseType::getListener(index); |
184 | } | 184 | } |
185 | 185 | ||
186 | bool contains(T* xform) | 186 | inline bool contains(T* xform) |
187 | { | 187 | { |
188 | return contains(xform->getBinRadius()); | 188 | return contains(xform->getBinRadius()); |
189 | } | 189 | } |
diff --git a/linden/indra/llmath/llrect.h b/linden/indra/llmath/llrect.h index a17ab39..38a4983 100644 --- a/linden/indra/llmath/llrect.h +++ b/linden/indra/llmath/llrect.h | |||
@@ -213,47 +213,28 @@ public: | |||
213 | mBottom = llmin(mBottom, mTop); | 213 | mBottom = llmin(mBottom, mTop); |
214 | } | 214 | } |
215 | 215 | ||
216 | friend const LLRectBase& operator|=(LLRectBase &a, const LLRectBase &b) // Return rect including a & b | 216 | void unionWith(const LLRectBase &other) |
217 | { | 217 | { |
218 | a.mLeft = llmin(a.mLeft, b.mLeft); | 218 | mLeft = llmin(mLeft, other.mLeft); |
219 | a.mRight = llmax(a.mRight, b.mRight); | 219 | mRight = llmax(mRight, other.mRight); |
220 | a.mBottom = llmin(a.mBottom, b.mBottom); | 220 | mBottom = llmin(mBottom, other.mBottom); |
221 | a.mTop = llmax(a.mTop, b.mTop); | 221 | mTop = llmax(mTop, other.mTop); |
222 | return a; | ||
223 | } | 222 | } |
224 | 223 | ||
225 | friend LLRectBase operator|(const LLRectBase &a, const LLRectBase &b) // Return rect including a & b | 224 | void intersectWith(const LLRectBase &other) |
226 | { | 225 | { |
227 | LLRectBase<Type> result; | 226 | mLeft = llmax(mLeft, other.mLeft); |
228 | result.mLeft = llmin(a.mLeft, b.mLeft); | 227 | mRight = llmin(mRight, other.mRight); |
229 | result.mRight = llmax(a.mRight, b.mRight); | 228 | mBottom = llmax(mBottom, other.mBottom); |
230 | result.mBottom = llmin(a.mBottom, b.mBottom); | 229 | mTop = llmin(mTop, other.mTop); |
231 | result.mTop = llmax(a.mTop, b.mTop); | 230 | if (mLeft > mRight) |
232 | return result; | ||
233 | } | ||
234 | |||
235 | friend const LLRectBase& operator&=(LLRectBase &a, const LLRectBase &b) // set a to rect where a intersects b | ||
236 | { | ||
237 | a.mLeft = llmax(a.mLeft, b.mLeft); | ||
238 | a.mRight = llmin(a.mRight, b.mRight); | ||
239 | a.mBottom = llmax(a.mBottom, b.mBottom); | ||
240 | a.mTop = llmin(a.mTop, b.mTop); | ||
241 | if (a.mLeft > a.mRight) | ||
242 | { | 231 | { |
243 | a.mLeft = a.mRight; | 232 | mLeft = mRight; |
244 | } | 233 | } |
245 | if (a.mBottom > a.mTop) | 234 | if (mBottom > mTop) |
246 | { | 235 | { |
247 | a.mBottom = a.mTop; | 236 | mBottom = mTop; |
248 | } | 237 | } |
249 | return a; | ||
250 | } | ||
251 | |||
252 | friend LLRectBase operator&(const LLRectBase &a, const LLRectBase &b) // Return rect where a intersects b | ||
253 | { | ||
254 | LLRectBase result = a; | ||
255 | result &= b; | ||
256 | return result; | ||
257 | } | 238 | } |
258 | 239 | ||
259 | friend std::ostream &operator<<(std::ostream &s, const LLRectBase &rect) | 240 | friend std::ostream &operator<<(std::ostream &s, const LLRectBase &rect) |
diff --git a/linden/indra/llmath/lltreenode.h b/linden/indra/llmath/lltreenode.h index a47795d..8a8710f 100644 --- a/linden/indra/llmath/lltreenode.h +++ b/linden/indra/llmath/lltreenode.h | |||
@@ -69,17 +69,17 @@ class LLTreeNode | |||
69 | public: | 69 | public: |
70 | LLTreeNode(LLTreeState<T>* state) { setState(state); } | 70 | LLTreeNode(LLTreeState<T>* state) { setState(state); } |
71 | virtual ~LLTreeNode(); | 71 | virtual ~LLTreeNode(); |
72 | virtual LLTreeState<T>* getState() { return mState; } | 72 | LLTreeState<T>* getState() { return mState; } |
73 | virtual const LLTreeState<T>* getState() const { return mState; } | 73 | const LLTreeState<T>* getState() const { return mState; } |
74 | 74 | ||
75 | virtual void setState(LLTreeState<T>* state); | 75 | void setState(LLTreeState<T>* state); |
76 | virtual void insert(T* data); | 76 | void insert(T* data); |
77 | virtual bool remove(T* data); | 77 | bool remove(T* data); |
78 | virtual void notifyRemoval(T* data); | 78 | void notifyRemoval(T* data); |
79 | virtual U32 getListenerCount() { return mListeners.size(); } | 79 | inline U32 getListenerCount() { return mListeners.size(); } |
80 | virtual LLTreeListener<T>* getListener(U32 index) const { return mListeners[index]; } | 80 | inline LLTreeListener<T>* getListener(U32 index) const { return mListeners[index]; } |
81 | virtual void addListener(LLTreeListener<T>* listener) { mListeners.push_back(listener); } | 81 | inline void addListener(LLTreeListener<T>* listener) { mListeners.push_back(listener); } |
82 | virtual void removeListener(U32 index) { mListeners.erase(mListeners.begin()+index); } | 82 | inline void removeListener(U32 index) { mListeners.erase(mListeners.begin()+index); } |
83 | 83 | ||
84 | protected: | 84 | protected: |
85 | void destroyListeners() | 85 | void destroyListeners() |
diff --git a/linden/indra/llmath/lluuid.cpp b/linden/indra/llmath/lluuid.cpp index 0fed6b3..97d8c1c 100644 --- a/linden/indra/llmath/lluuid.cpp +++ b/linden/indra/llmath/lluuid.cpp | |||
@@ -613,7 +613,9 @@ S32 LLUUID::getNodeID(unsigned char *node_id) | |||
613 | #define HAVE_NETINET_IN_H | 613 | #define HAVE_NETINET_IN_H |
614 | #ifdef HAVE_NETINET_IN_H | 614 | #ifdef HAVE_NETINET_IN_H |
615 | #include <netinet/in.h> | 615 | #include <netinet/in.h> |
616 | #if !LL_DARWIN | 616 | #if LL_SOLARIS |
617 | #include <sys/sockio.h> | ||
618 | #elif !LL_DARWIN | ||
617 | #include <linux/sockios.h> | 619 | #include <linux/sockios.h> |
618 | #endif | 620 | #endif |
619 | #endif | 621 | #endif |
diff --git a/linden/indra/llmath/llv4math.h b/linden/indra/llmath/llv4math.h new file mode 100644 index 0000000..2853ab6 --- /dev/null +++ b/linden/indra/llmath/llv4math.h | |||
@@ -0,0 +1,143 @@ | |||
1 | /** | ||
2 | * @file llv4math.h | ||
3 | * @brief LLV4* class header file - vector processor enabled math | ||
4 | * | ||
5 | * Copyright (c) 2007-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * Second Life Viewer Source Code | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | #ifndef LL_LLV4MATH_H | ||
30 | #define LL_LLV4MATH_H | ||
31 | |||
32 | // *NOTE: We do not support SSE acceleration on Windows builds. | ||
33 | // Our minimum specification for the viewer includes 1 GHz Athlon processors, | ||
34 | // which covers the Athlon Thunderbird series that does not support SSE. | ||
35 | // | ||
36 | // Our header files include statements like this | ||
37 | // const F32 HAVOK_TIMESTEP = 1.f / 45.f; | ||
38 | // This creates "globals" that are included in each .obj file. If a single | ||
39 | // .cpp file has SSE code generation turned on (eg, llviewerjointmesh_sse.cpp) | ||
40 | // these globals will be initialized using SSE instructions. This causes SL | ||
41 | // to crash before main() on processors without SSE. Untangling all these | ||
42 | // headers/variables is too much work for the small performance gains of | ||
43 | // vectorization. | ||
44 | // | ||
45 | // Therefore we only support vectorization on builds where the everything is | ||
46 | // built with SSE or Altivec. See https://jira.secondlife.com/browse/VWR-1610 | ||
47 | // and https://jira.lindenlab.com/browse/SL-47720 for details. | ||
48 | // | ||
49 | // Sorry the code is such a mess. JC | ||
50 | |||
51 | //----------------------------------------------------------------------------- | ||
52 | //----------------------------------------------------------------------------- | ||
53 | // LLV4MATH - GNUC | ||
54 | //----------------------------------------------------------------------------- | ||
55 | //----------------------------------------------------------------------------- | ||
56 | |||
57 | #if LL_GNUC && __GNUC__ >= 4 && __SSE__ | ||
58 | |||
59 | #define LL_VECTORIZE 1 | ||
60 | |||
61 | #if LL_DARWIN | ||
62 | |||
63 | #include <Accelerate/Accelerate.h> | ||
64 | #include <xmmintrin.h> | ||
65 | typedef vFloat V4F32; | ||
66 | |||
67 | #else | ||
68 | |||
69 | #include <xmmintrin.h> | ||
70 | typedef float V4F32 __attribute__((vector_size(16))); | ||
71 | |||
72 | #endif | ||
73 | |||
74 | #endif | ||
75 | #if LL_GNUC | ||
76 | |||
77 | #define LL_LLV4MATH_ALIGN_PREFIX | ||
78 | #define LL_LLV4MATH_ALIGN_POSTFIX __attribute__((aligned(16))) | ||
79 | |||
80 | #endif | ||
81 | |||
82 | //----------------------------------------------------------------------------- | ||
83 | //----------------------------------------------------------------------------- | ||
84 | // LLV4MATH - MSVC | ||
85 | //----------------------------------------------------------------------------- | ||
86 | //----------------------------------------------------------------------------- | ||
87 | |||
88 | // Only vectorize if the entire Windows build uses SSE. | ||
89 | // _M_IX86_FP is set when SSE code generation is turned on, and I have | ||
90 | // confirmed this in VS2003, VS2003 SP1, and VS2005. JC | ||
91 | #if LL_MSVC && _M_IX86_FP | ||
92 | |||
93 | #define LL_VECTORIZE 1 | ||
94 | |||
95 | #include <xmmintrin.h> | ||
96 | |||
97 | typedef __m128 V4F32; | ||
98 | |||
99 | #endif | ||
100 | #if LL_MSVC | ||
101 | |||
102 | #define LL_LLV4MATH_ALIGN_PREFIX __declspec(align(16)) | ||
103 | #define LL_LLV4MATH_ALIGN_POSTFIX | ||
104 | |||
105 | #endif | ||
106 | |||
107 | //----------------------------------------------------------------------------- | ||
108 | //----------------------------------------------------------------------------- | ||
109 | // LLV4MATH - default - no vectorization | ||
110 | //----------------------------------------------------------------------------- | ||
111 | //----------------------------------------------------------------------------- | ||
112 | |||
113 | #if !LL_VECTORIZE | ||
114 | |||
115 | #define LL_VECTORIZE 0 | ||
116 | |||
117 | struct V4F32 { F32 __pad__[4]; }; | ||
118 | |||
119 | inline F32 llv4lerp(F32 a, F32 b, F32 w) { return ( b - a ) * w + a; } | ||
120 | |||
121 | #endif | ||
122 | |||
123 | #ifndef LL_LLV4MATH_ALIGN_PREFIX | ||
124 | # define LL_LLV4MATH_ALIGN_PREFIX | ||
125 | #endif | ||
126 | #ifndef LL_LLV4MATH_ALIGN_POSTFIX | ||
127 | # define LL_LLV4MATH_ALIGN_POSTFIX | ||
128 | #endif | ||
129 | |||
130 | //----------------------------------------------------------------------------- | ||
131 | //----------------------------------------------------------------------------- | ||
132 | // LLV4MATH | ||
133 | //----------------------------------------------------------------------------- | ||
134 | //----------------------------------------------------------------------------- | ||
135 | |||
136 | |||
137 | #define LLV4_NUM_AXIS 4 | ||
138 | |||
139 | class LLV4Vector3; | ||
140 | class LLV4Matrix3; | ||
141 | class LLV4Matrix4; | ||
142 | |||
143 | #endif | ||
diff --git a/linden/indra/llmath/llv4matrix3.h b/linden/indra/llmath/llv4matrix3.h new file mode 100644 index 0000000..0811338 --- /dev/null +++ b/linden/indra/llmath/llv4matrix3.h | |||
@@ -0,0 +1,222 @@ | |||
1 | /** | ||
2 | * @file llviewerjointmesh.cpp | ||
3 | * @brief LLV4* class header file - vector processor enabled math | ||
4 | * | ||
5 | * Copyright (c) 2007-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * Second Life Viewer Source Code | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | #ifndef LL_LLV4MATRIX3_H | ||
30 | #define LL_LLV4MATRIX3_H | ||
31 | |||
32 | #include "llv4math.h" | ||
33 | #include "llv4vector3.h" | ||
34 | #include "m3math.h" // for operator LLMatrix3() | ||
35 | |||
36 | //----------------------------------------------------------------------------- | ||
37 | //----------------------------------------------------------------------------- | ||
38 | // LLV4Matrix3 | ||
39 | //----------------------------------------------------------------------------- | ||
40 | //----------------------------------------------------------------------------- | ||
41 | |||
42 | LL_LLV4MATH_ALIGN_PREFIX | ||
43 | |||
44 | class LLV4Matrix3 | ||
45 | { | ||
46 | public: | ||
47 | union { | ||
48 | F32 mMatrix[LLV4_NUM_AXIS][LLV4_NUM_AXIS]; | ||
49 | V4F32 mV[LLV4_NUM_AXIS]; | ||
50 | }; | ||
51 | |||
52 | void lerp(const LLV4Matrix3 &a, const LLV4Matrix3 &b, const F32 &w); | ||
53 | void multiply(const LLVector3 &a, LLVector3& out) const; | ||
54 | void multiply(const LLVector4 &a, LLV4Vector3& out) const; | ||
55 | void multiply(const LLVector3 &a, LLV4Vector3& out) const; | ||
56 | |||
57 | const LLV4Matrix3& transpose(); | ||
58 | const LLV4Matrix3& operator=(const LLMatrix3& a); | ||
59 | |||
60 | operator LLMatrix3() const { return (reinterpret_cast<const LLMatrix4*>(const_cast<const F32*>(&mMatrix[0][0])))->getMat3(); } | ||
61 | |||
62 | friend LLVector3 operator*(const LLVector3& a, const LLV4Matrix3& b); | ||
63 | } | ||
64 | |||
65 | LL_LLV4MATH_ALIGN_POSTFIX; | ||
66 | |||
67 | |||
68 | |||
69 | //----------------------------------------------------------------------------- | ||
70 | //----------------------------------------------------------------------------- | ||
71 | // LLV4Matrix3 - SSE | ||
72 | //----------------------------------------------------------------------------- | ||
73 | //----------------------------------------------------------------------------- | ||
74 | |||
75 | #if LL_VECTORIZE | ||
76 | |||
77 | inline void LLV4Matrix3::lerp(const LLV4Matrix3 &a, const LLV4Matrix3 &b, const F32 &w) | ||
78 | { | ||
79 | __m128 vw = _mm_set1_ps(w); | ||
80 | mV[VX] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VX], a.mV[VX]), vw), a.mV[VX]); // ( b - a ) * w + a | ||
81 | mV[VY] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VY], a.mV[VY]), vw), a.mV[VY]); | ||
82 | mV[VZ] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VZ], a.mV[VZ]), vw), a.mV[VZ]); | ||
83 | } | ||
84 | |||
85 | inline void LLV4Matrix3::multiply(const LLVector3 &a, LLVector3& o) const | ||
86 | { | ||
87 | LLV4Vector3 j; | ||
88 | j.v = _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX]); // ( ax * vx ) + ... | ||
89 | j.v = _mm_add_ps(j.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY])); | ||
90 | j.v = _mm_add_ps(j.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ])); | ||
91 | o.setVec(j.mV); | ||
92 | } | ||
93 | |||
94 | inline void LLV4Matrix3::multiply(const LLVector4 &a, LLV4Vector3& o) const | ||
95 | { | ||
96 | o.v = _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX]); // ( ax * vx ) + ... | ||
97 | o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY])); | ||
98 | o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ])); | ||
99 | } | ||
100 | |||
101 | inline void LLV4Matrix3::multiply(const LLVector3 &a, LLV4Vector3& o) const | ||
102 | { | ||
103 | o.v = _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX]); // ( ax * vx ) + ... | ||
104 | o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY])); | ||
105 | o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ])); | ||
106 | } | ||
107 | |||
108 | //----------------------------------------------------------------------------- | ||
109 | //----------------------------------------------------------------------------- | ||
110 | // LLV4Matrix3 | ||
111 | //----------------------------------------------------------------------------- | ||
112 | //----------------------------------------------------------------------------- | ||
113 | |||
114 | #else | ||
115 | |||
116 | inline void LLV4Matrix3::lerp(const LLV4Matrix3 &a, const LLV4Matrix3 &b, const F32 &w) | ||
117 | { | ||
118 | mMatrix[VX][VX] = llv4lerp(a.mMatrix[VX][VX], b.mMatrix[VX][VX], w); | ||
119 | mMatrix[VX][VY] = llv4lerp(a.mMatrix[VX][VY], b.mMatrix[VX][VY], w); | ||
120 | mMatrix[VX][VZ] = llv4lerp(a.mMatrix[VX][VZ], b.mMatrix[VX][VZ], w); | ||
121 | |||
122 | mMatrix[VY][VX] = llv4lerp(a.mMatrix[VY][VX], b.mMatrix[VY][VX], w); | ||
123 | mMatrix[VY][VY] = llv4lerp(a.mMatrix[VY][VY], b.mMatrix[VY][VY], w); | ||
124 | mMatrix[VY][VZ] = llv4lerp(a.mMatrix[VY][VZ], b.mMatrix[VY][VZ], w); | ||
125 | |||
126 | mMatrix[VZ][VX] = llv4lerp(a.mMatrix[VZ][VX], b.mMatrix[VZ][VX], w); | ||
127 | mMatrix[VZ][VY] = llv4lerp(a.mMatrix[VZ][VY], b.mMatrix[VZ][VY], w); | ||
128 | mMatrix[VZ][VZ] = llv4lerp(a.mMatrix[VZ][VZ], b.mMatrix[VZ][VZ], w); | ||
129 | } | ||
130 | |||
131 | inline void LLV4Matrix3::multiply(const LLVector3 &a, LLVector3& o) const | ||
132 | { | ||
133 | o.setVec( a.mV[VX] * mMatrix[VX][VX] + | ||
134 | a.mV[VY] * mMatrix[VY][VX] + | ||
135 | a.mV[VZ] * mMatrix[VZ][VX], | ||
136 | |||
137 | a.mV[VX] * mMatrix[VX][VY] + | ||
138 | a.mV[VY] * mMatrix[VY][VY] + | ||
139 | a.mV[VZ] * mMatrix[VZ][VY], | ||
140 | |||
141 | a.mV[VX] * mMatrix[VX][VZ] + | ||
142 | a.mV[VY] * mMatrix[VY][VZ] + | ||
143 | a.mV[VZ] * mMatrix[VZ][VZ]); | ||
144 | } | ||
145 | |||
146 | inline void LLV4Matrix3::multiply(const LLVector4 &a, LLV4Vector3& o) const | ||
147 | { | ||
148 | o.setVec( a.mV[VX] * mMatrix[VX][VX] + | ||
149 | a.mV[VY] * mMatrix[VY][VX] + | ||
150 | a.mV[VZ] * mMatrix[VZ][VX], | ||
151 | |||
152 | a.mV[VX] * mMatrix[VX][VY] + | ||
153 | a.mV[VY] * mMatrix[VY][VY] + | ||
154 | a.mV[VZ] * mMatrix[VZ][VY], | ||
155 | |||
156 | a.mV[VX] * mMatrix[VX][VZ] + | ||
157 | a.mV[VY] * mMatrix[VY][VZ] + | ||
158 | a.mV[VZ] * mMatrix[VZ][VZ]); | ||
159 | } | ||
160 | |||
161 | inline void LLV4Matrix3::multiply(const LLVector3 &a, LLV4Vector3& o) const | ||
162 | { | ||
163 | o.setVec( a.mV[VX] * mMatrix[VX][VX] + | ||
164 | a.mV[VY] * mMatrix[VY][VX] + | ||
165 | a.mV[VZ] * mMatrix[VZ][VX], | ||
166 | |||
167 | a.mV[VX] * mMatrix[VX][VY] + | ||
168 | a.mV[VY] * mMatrix[VY][VY] + | ||
169 | a.mV[VZ] * mMatrix[VZ][VY], | ||
170 | |||
171 | a.mV[VX] * mMatrix[VX][VZ] + | ||
172 | a.mV[VY] * mMatrix[VY][VZ] + | ||
173 | a.mV[VZ] * mMatrix[VZ][VZ]); | ||
174 | } | ||
175 | |||
176 | //----------------------------------------------------------------------------- | ||
177 | //----------------------------------------------------------------------------- | ||
178 | // LLV4Matrix3 | ||
179 | //----------------------------------------------------------------------------- | ||
180 | //----------------------------------------------------------------------------- | ||
181 | |||
182 | #endif | ||
183 | |||
184 | inline const LLV4Matrix3& LLV4Matrix3::transpose() | ||
185 | { | ||
186 | #if LL_VECTORIZE && defined(_MM_TRANSPOSE4_PS) | ||
187 | _MM_TRANSPOSE4_PS(mV[VX], mV[VY], mV[VZ], mV[VW]); | ||
188 | return *this; | ||
189 | #else | ||
190 | F32 temp; | ||
191 | temp = mMatrix[VX][VY]; mMatrix[VX][VY] = mMatrix[VY][VX]; mMatrix[VY][VX] = temp; | ||
192 | temp = mMatrix[VX][VZ]; mMatrix[VX][VZ] = mMatrix[VZ][VX]; mMatrix[VZ][VX] = temp; | ||
193 | temp = mMatrix[VY][VZ]; mMatrix[VY][VZ] = mMatrix[VZ][VY]; mMatrix[VZ][VY] = temp; | ||
194 | #endif | ||
195 | return *this; | ||
196 | } | ||
197 | |||
198 | inline const LLV4Matrix3& LLV4Matrix3::operator=(const LLMatrix3& a) | ||
199 | { | ||
200 | memcpy(mMatrix[VX], a.mMatrix[VX], sizeof(F32) * 3 ); | ||
201 | memcpy(mMatrix[VY], a.mMatrix[VY], sizeof(F32) * 3 ); | ||
202 | memcpy(mMatrix[VZ], a.mMatrix[VZ], sizeof(F32) * 3 ); | ||
203 | return *this; | ||
204 | } | ||
205 | |||
206 | inline LLVector3 operator*(const LLVector3& a, const LLV4Matrix3& b) | ||
207 | { | ||
208 | return LLVector3( | ||
209 | a.mV[VX] * b.mMatrix[VX][VX] + | ||
210 | a.mV[VY] * b.mMatrix[VY][VX] + | ||
211 | a.mV[VZ] * b.mMatrix[VZ][VX], | ||
212 | |||
213 | a.mV[VX] * b.mMatrix[VX][VY] + | ||
214 | a.mV[VY] * b.mMatrix[VY][VY] + | ||
215 | a.mV[VZ] * b.mMatrix[VZ][VY], | ||
216 | |||
217 | a.mV[VX] * b.mMatrix[VX][VZ] + | ||
218 | a.mV[VY] * b.mMatrix[VY][VZ] + | ||
219 | a.mV[VZ] * b.mMatrix[VZ][VZ] ); | ||
220 | } | ||
221 | |||
222 | #endif | ||
diff --git a/linden/indra/llmath/llv4matrix4.h b/linden/indra/llmath/llv4matrix4.h new file mode 100644 index 0000000..38280a2 --- /dev/null +++ b/linden/indra/llmath/llv4matrix4.h | |||
@@ -0,0 +1,251 @@ | |||
1 | /** | ||
2 | * @file llviewerjointmesh.cpp | ||
3 | * @brief LLV4* class header file - vector processor enabled math | ||
4 | * | ||
5 | * Copyright (c) 2007-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * Second Life Viewer Source Code | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | #ifndef LL_LLV4MATRIX4_H | ||
30 | #define LL_LLV4MATRIX4_H | ||
31 | |||
32 | #include "llv4math.h" | ||
33 | #include "llv4matrix3.h" // just for operator LLV4Matrix3() | ||
34 | #include "llv4vector3.h" | ||
35 | |||
36 | //----------------------------------------------------------------------------- | ||
37 | //----------------------------------------------------------------------------- | ||
38 | // LLV4Matrix4 | ||
39 | //----------------------------------------------------------------------------- | ||
40 | //----------------------------------------------------------------------------- | ||
41 | |||
42 | LL_LLV4MATH_ALIGN_PREFIX | ||
43 | |||
44 | class LLV4Matrix4 | ||
45 | { | ||
46 | public: | ||
47 | union { | ||
48 | F32 mMatrix[LLV4_NUM_AXIS][LLV4_NUM_AXIS]; | ||
49 | V4F32 mV[LLV4_NUM_AXIS]; | ||
50 | }; | ||
51 | |||
52 | void lerp(const LLV4Matrix4 &a, const LLV4Matrix4 &b, const F32 &w); | ||
53 | void multiply(const LLVector3 &a, LLVector3& o) const; | ||
54 | void multiply(const LLVector3 &a, LLV4Vector3& o) const; | ||
55 | |||
56 | const LLV4Matrix4& transpose(); | ||
57 | const LLV4Matrix4& translate(const LLVector3 &vec); | ||
58 | const LLV4Matrix4& translate(const LLV4Vector3 &vec); | ||
59 | const LLV4Matrix4& operator=(const LLMatrix4& a); | ||
60 | |||
61 | operator LLMatrix4() const { return *(reinterpret_cast<const LLMatrix4*>(const_cast<const F32*>(&mMatrix[0][0]))); } | ||
62 | operator LLV4Matrix3() const { return *(reinterpret_cast<const LLV4Matrix3*>(const_cast<const F32*>(&mMatrix[0][0]))); } | ||
63 | |||
64 | friend LLVector3 operator*(const LLVector3 &a, const LLV4Matrix4 &b); | ||
65 | } | ||
66 | |||
67 | LL_LLV4MATH_ALIGN_POSTFIX; | ||
68 | |||
69 | //----------------------------------------------------------------------------- | ||
70 | //----------------------------------------------------------------------------- | ||
71 | // LLV4Matrix4 - SSE | ||
72 | //----------------------------------------------------------------------------- | ||
73 | //----------------------------------------------------------------------------- | ||
74 | |||
75 | #if LL_VECTORIZE | ||
76 | |||
77 | inline void LLV4Matrix4::lerp(const LLV4Matrix4 &a, const LLV4Matrix4 &b, const F32 &w) | ||
78 | { | ||
79 | __m128 vw = _mm_set1_ps(w); | ||
80 | mV[VX] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VX], a.mV[VX]), vw), a.mV[VX]); // ( b - a ) * w + a | ||
81 | mV[VY] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VY], a.mV[VY]), vw), a.mV[VY]); | ||
82 | mV[VZ] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VZ], a.mV[VZ]), vw), a.mV[VZ]); | ||
83 | mV[VW] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VW], a.mV[VW]), vw), a.mV[VW]); | ||
84 | } | ||
85 | |||
86 | inline void LLV4Matrix4::multiply(const LLVector3 &a, LLVector3& o) const | ||
87 | { | ||
88 | LLV4Vector3 j; | ||
89 | j.v = _mm_add_ps(mV[VW], _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX])); // ( ax * vx ) + vw | ||
90 | j.v = _mm_add_ps(j.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY])); | ||
91 | j.v = _mm_add_ps(j.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ])); | ||
92 | o.setVec(j.mV); | ||
93 | } | ||
94 | |||
95 | inline void LLV4Matrix4::multiply(const LLVector3 &a, LLV4Vector3& o) const | ||
96 | { | ||
97 | o.v = _mm_add_ps(mV[VW], _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX])); // ( ax * vx ) + vw | ||
98 | o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY])); | ||
99 | o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ])); | ||
100 | } | ||
101 | |||
102 | inline const LLV4Matrix4& LLV4Matrix4::translate(const LLV4Vector3 &vec) | ||
103 | { | ||
104 | mV[VW] = _mm_add_ps(mV[VW], vec.v); | ||
105 | return (*this); | ||
106 | } | ||
107 | |||
108 | //----------------------------------------------------------------------------- | ||
109 | //----------------------------------------------------------------------------- | ||
110 | // LLV4Matrix4 | ||
111 | //----------------------------------------------------------------------------- | ||
112 | //----------------------------------------------------------------------------- | ||
113 | |||
114 | #else | ||
115 | |||
116 | inline void LLV4Matrix4::lerp(const LLV4Matrix4 &a, const LLV4Matrix4 &b, const F32 &w) | ||
117 | { | ||
118 | mMatrix[VX][VX] = llv4lerp(a.mMatrix[VX][VX], b.mMatrix[VX][VX], w); | ||
119 | mMatrix[VX][VY] = llv4lerp(a.mMatrix[VX][VY], b.mMatrix[VX][VY], w); | ||
120 | mMatrix[VX][VZ] = llv4lerp(a.mMatrix[VX][VZ], b.mMatrix[VX][VZ], w); | ||
121 | |||
122 | mMatrix[VY][VX] = llv4lerp(a.mMatrix[VY][VX], b.mMatrix[VY][VX], w); | ||
123 | mMatrix[VY][VY] = llv4lerp(a.mMatrix[VY][VY], b.mMatrix[VY][VY], w); | ||
124 | mMatrix[VY][VZ] = llv4lerp(a.mMatrix[VY][VZ], b.mMatrix[VY][VZ], w); | ||
125 | |||
126 | mMatrix[VZ][VX] = llv4lerp(a.mMatrix[VZ][VX], b.mMatrix[VZ][VX], w); | ||
127 | mMatrix[VZ][VY] = llv4lerp(a.mMatrix[VZ][VY], b.mMatrix[VZ][VY], w); | ||
128 | mMatrix[VZ][VZ] = llv4lerp(a.mMatrix[VZ][VZ], b.mMatrix[VZ][VZ], w); | ||
129 | |||
130 | mMatrix[VW][VX] = llv4lerp(a.mMatrix[VW][VX], b.mMatrix[VW][VX], w); | ||
131 | mMatrix[VW][VY] = llv4lerp(a.mMatrix[VW][VY], b.mMatrix[VW][VY], w); | ||
132 | mMatrix[VW][VZ] = llv4lerp(a.mMatrix[VW][VZ], b.mMatrix[VW][VZ], w); | ||
133 | } | ||
134 | |||
135 | inline void LLV4Matrix4::multiply(const LLVector3 &a, LLVector3& o) const | ||
136 | { | ||
137 | o.setVec( a.mV[VX] * mMatrix[VX][VX] + | ||
138 | a.mV[VY] * mMatrix[VY][VX] + | ||
139 | a.mV[VZ] * mMatrix[VZ][VX] + | ||
140 | mMatrix[VW][VX], | ||
141 | |||
142 | a.mV[VX] * mMatrix[VX][VY] + | ||
143 | a.mV[VY] * mMatrix[VY][VY] + | ||
144 | a.mV[VZ] * mMatrix[VZ][VY] + | ||
145 | mMatrix[VW][VY], | ||
146 | |||
147 | a.mV[VX] * mMatrix[VX][VZ] + | ||
148 | a.mV[VY] * mMatrix[VY][VZ] + | ||
149 | a.mV[VZ] * mMatrix[VZ][VZ] + | ||
150 | mMatrix[VW][VZ]); | ||
151 | } | ||
152 | |||
153 | inline void LLV4Matrix4::multiply(const LLVector3 &a, LLV4Vector3& o) const | ||
154 | { | ||
155 | o.setVec( a.mV[VX] * mMatrix[VX][VX] + | ||
156 | a.mV[VY] * mMatrix[VY][VX] + | ||
157 | a.mV[VZ] * mMatrix[VZ][VX] + | ||
158 | mMatrix[VW][VX], | ||
159 | |||
160 | a.mV[VX] * mMatrix[VX][VY] + | ||
161 | a.mV[VY] * mMatrix[VY][VY] + | ||
162 | a.mV[VZ] * mMatrix[VZ][VY] + | ||
163 | mMatrix[VW][VY], | ||
164 | |||
165 | a.mV[VX] * mMatrix[VX][VZ] + | ||
166 | a.mV[VY] * mMatrix[VY][VZ] + | ||
167 | a.mV[VZ] * mMatrix[VZ][VZ] + | ||
168 | mMatrix[VW][VZ]); | ||
169 | } | ||
170 | |||
171 | inline const LLV4Matrix4& LLV4Matrix4::translate(const LLV4Vector3 &vec) | ||
172 | { | ||
173 | mMatrix[3][0] += vec.mV[0]; | ||
174 | mMatrix[3][1] += vec.mV[1]; | ||
175 | mMatrix[3][2] += vec.mV[2]; | ||
176 | return (*this); | ||
177 | } | ||
178 | |||
179 | //----------------------------------------------------------------------------- | ||
180 | //----------------------------------------------------------------------------- | ||
181 | // LLV4Matrix4 | ||
182 | //----------------------------------------------------------------------------- | ||
183 | //----------------------------------------------------------------------------- | ||
184 | |||
185 | #endif | ||
186 | |||
187 | inline const LLV4Matrix4& LLV4Matrix4::operator=(const LLMatrix4& a) | ||
188 | { | ||
189 | memcpy(mMatrix, a.mMatrix, sizeof(F32) * 16 ); | ||
190 | return *this; | ||
191 | } | ||
192 | |||
193 | inline const LLV4Matrix4& LLV4Matrix4::transpose() | ||
194 | { | ||
195 | #if LL_VECTORIZE && defined(_MM_TRANSPOSE4_PS) | ||
196 | _MM_TRANSPOSE4_PS(mV[VX], mV[VY], mV[VZ], mV[VW]); | ||
197 | #else | ||
198 | LLV4Matrix4 mat; | ||
199 | mat.mMatrix[0][0] = mMatrix[0][0]; | ||
200 | mat.mMatrix[1][0] = mMatrix[0][1]; | ||
201 | mat.mMatrix[2][0] = mMatrix[0][2]; | ||
202 | mat.mMatrix[3][0] = mMatrix[0][3]; | ||
203 | |||
204 | mat.mMatrix[0][1] = mMatrix[1][0]; | ||
205 | mat.mMatrix[1][1] = mMatrix[1][1]; | ||
206 | mat.mMatrix[2][1] = mMatrix[1][2]; | ||
207 | mat.mMatrix[3][1] = mMatrix[1][3]; | ||
208 | |||
209 | mat.mMatrix[0][2] = mMatrix[2][0]; | ||
210 | mat.mMatrix[1][2] = mMatrix[2][1]; | ||
211 | mat.mMatrix[2][2] = mMatrix[2][2]; | ||
212 | mat.mMatrix[3][2] = mMatrix[2][3]; | ||
213 | |||
214 | mat.mMatrix[0][3] = mMatrix[3][0]; | ||
215 | mat.mMatrix[1][3] = mMatrix[3][1]; | ||
216 | mat.mMatrix[2][3] = mMatrix[3][2]; | ||
217 | mat.mMatrix[3][3] = mMatrix[3][3]; | ||
218 | |||
219 | *this = mat; | ||
220 | #endif | ||
221 | return *this; | ||
222 | } | ||
223 | |||
224 | inline const LLV4Matrix4& LLV4Matrix4::translate(const LLVector3 &vec) | ||
225 | { | ||
226 | mMatrix[3][0] += vec.mV[0]; | ||
227 | mMatrix[3][1] += vec.mV[1]; | ||
228 | mMatrix[3][2] += vec.mV[2]; | ||
229 | return (*this); | ||
230 | } | ||
231 | |||
232 | inline LLVector3 operator*(const LLVector3 &a, const LLV4Matrix4 &b) | ||
233 | { | ||
234 | return LLVector3(a.mV[VX] * b.mMatrix[VX][VX] + | ||
235 | a.mV[VY] * b.mMatrix[VY][VX] + | ||
236 | a.mV[VZ] * b.mMatrix[VZ][VX] + | ||
237 | b.mMatrix[VW][VX], | ||
238 | |||
239 | a.mV[VX] * b.mMatrix[VX][VY] + | ||
240 | a.mV[VY] * b.mMatrix[VY][VY] + | ||
241 | a.mV[VZ] * b.mMatrix[VZ][VY] + | ||
242 | b.mMatrix[VW][VY], | ||
243 | |||
244 | a.mV[VX] * b.mMatrix[VX][VZ] + | ||
245 | a.mV[VY] * b.mMatrix[VY][VZ] + | ||
246 | a.mV[VZ] * b.mMatrix[VZ][VZ] + | ||
247 | b.mMatrix[VW][VZ]); | ||
248 | } | ||
249 | |||
250 | |||
251 | #endif | ||
diff --git a/linden/indra/llmath/llv4vector3.h b/linden/indra/llmath/llv4vector3.h new file mode 100644 index 0000000..994e7f5 --- /dev/null +++ b/linden/indra/llmath/llv4vector3.h | |||
@@ -0,0 +1,82 @@ | |||
1 | /** | ||
2 | * @file llviewerjointmesh.cpp | ||
3 | * @brief LLV4* class header file - vector processor enabled math | ||
4 | * | ||
5 | * Copyright (c) 2007-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * Second Life Viewer Source Code | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | #ifndef LL_LLV4VECTOR3_H | ||
30 | #define LL_LLV4VECTOR3_H | ||
31 | |||
32 | #include "llv4math.h" | ||
33 | |||
34 | //----------------------------------------------------------------------------- | ||
35 | //----------------------------------------------------------------------------- | ||
36 | // LLV4Vector3 | ||
37 | //----------------------------------------------------------------------------- | ||
38 | //----------------------------------------------------------------------------- | ||
39 | |||
40 | LL_LLV4MATH_ALIGN_PREFIX | ||
41 | |||
42 | class LLV4Vector3 | ||
43 | { | ||
44 | public: | ||
45 | union { | ||
46 | F32 mV[LLV4_NUM_AXIS]; | ||
47 | V4F32 v; | ||
48 | }; | ||
49 | |||
50 | enum { | ||
51 | ALIGNMENT = 16 | ||
52 | }; | ||
53 | |||
54 | void setVec(F32 x, F32 y, F32 z); | ||
55 | void setVec(F32 a); | ||
56 | } | ||
57 | |||
58 | LL_LLV4MATH_ALIGN_POSTFIX; | ||
59 | |||
60 | //----------------------------------------------------------------------------- | ||
61 | //----------------------------------------------------------------------------- | ||
62 | // LLV4Vector3 | ||
63 | //----------------------------------------------------------------------------- | ||
64 | //----------------------------------------------------------------------------- | ||
65 | |||
66 | inline void LLV4Vector3::setVec(F32 x, F32 y, F32 z) | ||
67 | { | ||
68 | mV[VX] = x; | ||
69 | mV[VY] = y; | ||
70 | mV[VZ] = z; | ||
71 | } | ||
72 | |||
73 | inline void LLV4Vector3::setVec(F32 a) | ||
74 | { | ||
75 | #if LL_VECTORIZE | ||
76 | v = _mm_set1_ps(a); | ||
77 | #else | ||
78 | setVec(a, a, a); | ||
79 | #endif | ||
80 | } | ||
81 | |||
82 | #endif | ||
diff --git a/linden/indra/llmath/llvolume.cpp b/linden/indra/llmath/llvolume.cpp index 5764c38..c0a33c7 100644 --- a/linden/indra/llmath/llvolume.cpp +++ b/linden/indra/llmath/llvolume.cpp | |||
@@ -750,7 +750,11 @@ BOOL LLProfileParams::importFile(FILE *fp) | |||
750 | 750 | ||
751 | while (!feof(fp)) | 751 | while (!feof(fp)) |
752 | { | 752 | { |
753 | fgets(buffer, BUFSIZE, fp); | 753 | if (fgets(buffer, BUFSIZE, fp) == NULL) |
754 | { | ||
755 | buffer[0] = '\0'; | ||
756 | } | ||
757 | |||
754 | sscanf( /* Flawfinder: ignore */ | 758 | sscanf( /* Flawfinder: ignore */ |
755 | buffer, | 759 | buffer, |
756 | " %255s %255s", | 760 | " %255s %255s", |
@@ -1251,7 +1255,11 @@ BOOL LLPathParams::importFile(FILE *fp) | |||
1251 | 1255 | ||
1252 | while (!feof(fp)) | 1256 | while (!feof(fp)) |
1253 | { | 1257 | { |
1254 | fgets(buffer, BUFSIZE, fp); | 1258 | if (fgets(buffer, BUFSIZE, fp) == NULL) |
1259 | { | ||
1260 | buffer[0] = '\0'; | ||
1261 | } | ||
1262 | |||
1255 | sscanf( /* Flawfinder: ignore */ | 1263 | sscanf( /* Flawfinder: ignore */ |
1256 | buffer, | 1264 | buffer, |
1257 | " %255s %255s", | 1265 | " %255s %255s", |
@@ -3582,7 +3590,11 @@ BOOL LLVolumeParams::importFile(FILE *fp) | |||
3582 | 3590 | ||
3583 | while (!feof(fp)) | 3591 | while (!feof(fp)) |
3584 | { | 3592 | { |
3585 | fgets(buffer, BUFSIZE, fp); | 3593 | if (fgets(buffer, BUFSIZE, fp) == NULL) |
3594 | { | ||
3595 | buffer[0] = '\0'; | ||
3596 | } | ||
3597 | |||
3586 | sscanf(buffer, " %255s", keyword); /* Flawfinder: ignore */ | 3598 | sscanf(buffer, " %255s", keyword); /* Flawfinder: ignore */ |
3587 | if (!strcmp("{", keyword)) | 3599 | if (!strcmp("{", keyword)) |
3588 | { | 3600 | { |
diff --git a/linden/indra/llmath/llvolume.h b/linden/indra/llmath/llvolume.h index 8292d0c..ee28057 100644 --- a/linden/indra/llmath/llvolume.h +++ b/linden/indra/llmath/llvolume.h | |||
@@ -783,7 +783,7 @@ public: | |||
783 | FLAT_MASK = 0x0100, | 783 | FLAT_MASK = 0x0100, |
784 | TOP_MASK = 0x0200, | 784 | TOP_MASK = 0x0200, |
785 | BOTTOM_MASK = 0x0400 | 785 | BOTTOM_MASK = 0x0400 |
786 | } TypeMask; | 786 | }; |
787 | 787 | ||
788 | public: | 788 | public: |
789 | S32 mID; | 789 | S32 mID; |