diff --git a/src/debug_utils-inl.h b/src/debug_utils-inl.h index 470fdc3db95..d87dd62c895 100644 --- a/src/debug_utils-inl.h +++ b/src/debug_utils-inl.h @@ -30,16 +30,17 @@ struct ToStringHelper { template ::value, int>::type = 0> - static std::string BaseConvert(T value) { + static std::string BaseConvert(const T& value) { + auto v = static_cast(value); char ret[3 * sizeof(T)]; char* ptr = ret + 3 * sizeof(T) - 1; *ptr = '\0'; const char* digits = "0123456789abcdef"; do { - unsigned digit = value & ((1 << BASE_BITS) - 1); + unsigned digit = v & ((1 << BASE_BITS) - 1); *--ptr = (BASE_BITS < 4 ? static_cast('0' + digit) : digits[digit]); - } while ((value >>= BASE_BITS) != 0); + } while ((v >>= BASE_BITS) != 0); return ptr; } template -std::string ToBaseString(T&& value) { - return ToStringHelper::BaseConvert(std::forward(value)); +std::string ToBaseString(const T& value) { + return ToStringHelper::BaseConvert(value); } inline std::string SPrintFImpl(const char* format) {