diff options
author | Ptolemy <ptolemy@lindenlab.com> | 2022-01-13 21:09:52 -0800 |
---|---|---|
committer | Ptolemy <ptolemy@lindenlab.com> | 2022-01-14 12:24:21 -0800 |
commit | 1566c01ad16a973f22990653b3dab8e5bd476db8 (patch) | |
tree | d6d096cf2c2e0bb36f4180e9d38924dbc7bc05fa /indra | |
parent | 7495af2ecc055a7ed620d5bb4a60e44a4e166513 (diff) |
SL-16607: Cleanup magic number for no child nodes
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llmath/lloctree.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 8c4a1304b4..80eca781a9 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -92,10 +92,15 @@ public: typedef LLOctreeNode<T> oct_node; typedef LLOctreeListener<T> oct_listener; + enum + { + NO_CHILD_NODES = 255 // Note: This is an U8 to match the max value in mChildMap[] + }; + LLOctreeNode( const LLVector4a& center, const LLVector4a& size, BaseType* parent, - U8 octant = 255) + U8 octant = NO_CHILD_NODES) : mParent((oct_node*)parent), mOctant(octant) { @@ -108,7 +113,7 @@ public: mSize = size; updateMinMax(); - if ((mOctant == 255) && mParent) + if ((mOctant == NO_CHILD_NODES) && mParent) { mOctant = ((oct_node*) mParent)->getOctant(mCenter); } @@ -253,7 +258,7 @@ public: for (U32 i = 0; i < 8; i++) { U8 idx = mChildMap[i]; - if (idx != 255) + if (idx != NO_CHILD_NODES) { LLOctreeNode<T>* child = mChild[idx]; @@ -286,7 +291,7 @@ public: // the data U8 next_node = node->mChildMap[octant]; - while (next_node != 255 && node->getSize()[0] >= rad) + while (next_node != NO_CHILD_NODES && node->getSize()[0] >= rad) { node = node->getChild(next_node); octant = node->getOctant(pos); @@ -514,9 +519,7 @@ public: void clearChildren() { mChildCount = 0; - - U32* foo = (U32*) mChildMap; - foo[0] = foo[1] = 0xFFFFFFFF; + memset(mChildMap, NO_CHILD_NODES, sizeof(mChildMap)); } void validate() @@ -607,11 +610,9 @@ public: --mChildCount; mChild[index] = mChild[mChildCount]; - //rebuild child map - U32* foo = (U32*) mChildMap; - foo[0] = foo[1] = 0xFFFFFFFF; + memset(mChildMap, NO_CHILD_NODES, sizeof(mChildMap)); for (U32 i = 0; i < mChildCount; ++i) { |