Profiler: Fix casts and signedness on integer values

This commit is contained in:
Paul "Dettorer" Hervot 2015-11-29 10:58:10 +01:00 committed by Paul Dettorer Hervot
parent 96c20a2ed2
commit 58180a2db0
3 changed files with 5 additions and 5 deletions

View file

@ -59,7 +59,7 @@ unsigned int ProfilingManager::RegisterTimingCategory(TimingCategory* category,
info.name = name;
info.parent = TimingCategoryInfo::NO_PARENT;
unsigned int id = (unsigned int)timing_categories.size();
unsigned int id = static_cast<unsigned int>(timing_categories.size());
timing_categories.push_back(std::move(info));
return id;
@ -140,7 +140,7 @@ static AggregatedDuration AggregateField(const std::vector<Duration>& v, size_t
result.max = std::max(result.max, value);
}
if (len != 0)
result.avg /= len;
result.avg /= static_cast<const long>(len);
return result;
}
@ -177,7 +177,7 @@ ProfilingManager& GetProfilingManager() {
}
SynchronizedRef<TimingResultsAggregator> GetTimingResultsAggregator() {
static SynchronizedWrapper<TimingResultsAggregator> aggregator(30);
static SynchronizedWrapper<TimingResultsAggregator> aggregator(static_cast<size_t>(30));
return SynchronizedRef<TimingResultsAggregator>(aggregator);
}

View file

@ -64,7 +64,7 @@ public:
*/
Duration GetAccumulatedTime() {
return Duration(std::atomic_exchange_explicit(
&accumulated_duration, (Duration::rep)0,
&accumulated_duration, static_cast<Duration::rep>(0),
std::memory_order_relaxed));
}

View file

@ -14,7 +14,7 @@ namespace Common {
namespace Profiling {
struct TimingCategoryInfo {
static const unsigned int NO_PARENT = -1;
static const unsigned int NO_PARENT = std::numeric_limits<unsigned>::max();
TimingCategory* category;
const char* name;