diff options
author | Richard Linden <none@none> | 2012-10-23 23:35:15 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2012-10-23 23:35:15 -0700 |
commit | 1de6ecb23851e0784016a2c4c9f691c976c6bda7 (patch) | |
tree | be77ebb9db925016dd7b4c5627ac4d7533c56539 | |
parent | 28179ab0070a1c13193808bc1493761a8fed167f (diff) |
SH-3405 WIP convert existing stats to lltrace system
converted "int" to "S32"
-rw-r--r-- | indra/llcommon/llpredicate.cpp | 4 | ||||
-rw-r--r-- | indra/llcommon/llpredicate.h | 34 |
2 files changed, 21 insertions, 17 deletions
diff --git a/indra/llcommon/llpredicate.cpp b/indra/llcommon/llpredicate.cpp index 1ab1ab08f1..e3410ef3f6 100644 --- a/indra/llcommon/llpredicate.cpp +++ b/indra/llcommon/llpredicate.cpp @@ -31,10 +31,10 @@ namespace LLPredicate { EmptyRule make_rule() { return EmptyRule(); } - int predicateFlagsFromValue(int value) + S32 predicateFlagsFromValue(S32 value) { llassert(value < 5); - static const int predicates[5] = + static const S32 predicates[5] = { 0xAAAAaaaa, // 10101010101010101010101010101010 0xCCCCcccc, // 11001100110011001100110011001100 diff --git a/indra/llcommon/llpredicate.h b/indra/llcommon/llpredicate.h index 096238713c..5fd1d30295 100644 --- a/indra/llcommon/llpredicate.h +++ b/indra/llcommon/llpredicate.h @@ -33,7 +33,7 @@ namespace LLPredicate { template<typename ENUM> class Rule; - int predicateFlagsFromValue(int value); + S32 predicateFlagsFromValue(S32 value); template<typename ENUM> struct Value @@ -41,31 +41,35 @@ namespace LLPredicate friend Rule<ENUM>; public: Value(ENUM e) - : mPredicateCombinationFlags(0x1) + : mPredicateCombinationFlags(0xFFFFffff) { add(e); } Value() - : mPredicateCombinationFlags(0x1) + : mPredicateCombinationFlags(0xFFFFffff) {} void add(ENUM predicate) { llassert(predicate < 5); - if (!has(predicate)) - { - int predicate_shift = 0x1 << (int)predicate; - mPredicateCombinationFlags <<= predicate_shift; - } + S32 predicate_shift = 0x1 << (S32)predicate; + S32 flag_mask = predicateFlagsFromValue(predicate); + S32 flags_to_modify = mPredicateCombinationFlags & ~flag_mask; + // clear flags containing predicate to be removed + mPredicateCombinationFlags &= ~flag_mask; + // shift flags, in effect removing predicate + flags_to_modify <<= predicate_shift; + // put modified flags back + mPredicateCombinationFlags |= flags_to_modify; } void remove(ENUM predicate) { llassert(predicate < 5); - int predicate_shift = 0x1 << (int)predicate; - int flag_mask = predicateFlagsFromValue(predicate); - int flags_to_modify = mPredicateCombinationFlags & flag_mask; + S32 predicate_shift = 0x1 << (S32)predicate; + S32 flag_mask = predicateFlagsFromValue(predicate); + S32 flags_to_modify = mPredicateCombinationFlags & flag_mask; // clear flags containing predicate to be removed mPredicateCombinationFlags &= ~flag_mask; // shift flags, in effect removing predicate @@ -77,7 +81,7 @@ namespace LLPredicate void unknown(ENUM predicate) { add(predicate); - int flags_with_predicate = mPredicateCombinationFlags; + S32 flags_with_predicate = mPredicateCombinationFlags; remove(predicate); // unknown is result of adding and removing predicate at the same time! mPredicateCombinationFlags |= flags_with_predicate; @@ -85,12 +89,12 @@ namespace LLPredicate bool has(ENUM predicate) { - int flag_mask = predicateFlagsFromValue(predicate); + S32 flag_mask = predicateFlagsFromValue(predicate); return (mPredicateCombinationFlags & flag_mask) != 0; } private: - int mPredicateCombinationFlags; + S32 mPredicateCombinationFlags; }; struct EmptyRule {}; @@ -144,7 +148,7 @@ namespace LLPredicate } private: - int mPredicateRequirements; + S32 mPredicateRequirements; }; template<typename ENUM> |