diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2023-05-17 18:05:05 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2023-05-17 18:05:05 +0300 |
commit | 033b04f3883a0cc9024f45b5e9a0d792cf6dbb77 (patch) | |
tree | ac49627e31aabda8aaa4b21c74c5aee2b2ea46e8 /indra/llcommon | |
parent | 07dc391ab76a8860d04bfb001cdc686cd576663d (diff) | |
parent | 5a70639b7992842a9f74ec81b11bac56608b8f2e (diff) |
Merge branch 'main' into DRTVWR-582-maint-U
# Conflicts:
# indra/newview/llagentlistener.cpp
# indra/newview/llcommanddispatcherlistener.cpp
# indra/newview/llfilepicker_mac.mm
# indra/newview/llworldmapview.cpp
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llsd.cpp | 2 | ||||
-rw-r--r-- | indra/llcommon/llsd.h | 26 | ||||
-rw-r--r-- | indra/llcommon/lltimer.cpp | 11 |
3 files changed, 19 insertions, 20 deletions
diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index a645e624f8..590915e9d2 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -622,7 +622,7 @@ namespace if (index >= mData.size()) { - mData.resize(i + 1); + mData.resize(index + 1); } return mData[index]; diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index 4e9fcc77ee..cdb9a7ed8a 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -30,7 +30,6 @@ #include <map> #include <string> #include <vector> -#include <type_traits> #include "stdtypes.h" @@ -216,21 +215,15 @@ public: void assign(const Date&); void assign(const URI&); void assign(const Binary&); - - // support assignment from size_t et al. - template <typename VALUE, - typename std::enable_if<std::is_integral<VALUE>::value && - ! std::is_same<VALUE, Boolean>::value, - bool>::type = true> - void assign(VALUE v) { assign(Integer(narrow(v))); } - // support assignment from F32 et al. - template <typename VALUE, - typename std::enable_if<std::is_floating_point<VALUE>::value, - bool>::type = true> - void assign(VALUE v) { assign(Real(narrow(v))); } - - template <typename VALUE> - LLSD& operator=(VALUE v) { assign(v); return *this; } + + LLSD& operator=(Boolean v) { assign(v); return *this; } + LLSD& operator=(Integer v) { assign(v); return *this; } + LLSD& operator=(Real v) { assign(v); return *this; } + LLSD& operator=(const String& v) { assign(v); return *this; } + LLSD& operator=(const UUID& v) { assign(v); return *this; } + LLSD& operator=(const Date& v) { assign(v); return *this; } + LLSD& operator=(const URI& v) { assign(v); return *this; } + LLSD& operator=(const Binary& v) { assign(v); return *this; } //@} /** @@ -292,6 +285,7 @@ public: //@{ LLSD(const char*); void assign(const char*); + LLSD& operator=(const char* v) { assign(v); return *this; } //@} /** @name Map Values */ diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 74ec62d347..58bedacf43 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -121,9 +121,14 @@ U32 micro_sleep(U64 us, U32 max_yields) U64 start = get_clock_count(); // This is kernel dependent. Currently, our kernel generates software clock // interrupts at 250 Hz (every 4,000 microseconds). - const U64 KERNEL_SLEEP_INTERVAL_US = 4000; - - auto num_sleep_intervals = (us - (KERNEL_SLEEP_INTERVAL_US >> 1)) / KERNEL_SLEEP_INTERVAL_US; + const S64 KERNEL_SLEEP_INTERVAL_US = 4000; + + // Use signed arithmetic to discover whether a sleep is even necessary. If + // either 'us' or KERNEL_SLEEP_INTERVAL_US is unsigned, the compiler + // promotes the difference to unsigned. If 'us' is less than half + // KERNEL_SLEEP_INTERVAL_US, the unsigned difference will be hugely + // positive, resulting in a crazy long wait. + auto num_sleep_intervals = (S64(us) - (KERNEL_SLEEP_INTERVAL_US >> 1)) / KERNEL_SLEEP_INTERVAL_US; if (num_sleep_intervals > 0) { U64 sleep_time = (num_sleep_intervals * KERNEL_SLEEP_INTERVAL_US) - (KERNEL_SLEEP_INTERVAL_US >> 1); |