diff --git a/util/core_local.h b/util/core_local.h index 806584d46..7515c5423 100644 --- a/util/core_local.h +++ b/util/core_local.h @@ -38,23 +38,23 @@ class CoreLocalArray { private: std::unique_ptr data_; - size_t size_shift_; + int size_shift_; }; template CoreLocalArray::CoreLocalArray() { - unsigned int num_cpus = std::thread::hardware_concurrency(); + int num_cpus = static_cast(std::thread::hardware_concurrency()); // find a power of two >= num_cpus and >= 8 size_shift_ = 3; - while (1u << size_shift_ < num_cpus) { + while (1 << size_shift_ < num_cpus) { ++size_shift_; } - data_.reset(new T[1 << size_shift_]); + data_.reset(new T[static_cast(1) << size_shift_]); } template size_t CoreLocalArray::Size() const { - return 1u << size_shift_; + return static_cast(1) << size_shift_; } template @@ -77,7 +77,7 @@ std::pair CoreLocalArray::AccessElementAndIndex() const { template T* CoreLocalArray::AccessAtCore(size_t core_idx) const { - assert(core_idx < 1u << size_shift_); + assert(core_idx < static_cast(1) << size_shift_); return &data_[core_idx]; }