GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: fix warnings on SPrintF · nodejs/node@fabb53e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • debug_utils-inl.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/debug_utils-inl.h‎

Copy file name to clipboardExpand all lines: src/debug_utils-inl.h
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,17 @@ struct ToStringHelper {
3030
template <unsigned BASE_BITS,
3131
typename T,
3232
typename std::enable_if<std::is_integral<T>::value, int>::type = 0>
33-
static std::string BaseConvert(T value) {
33+
static std::string BaseConvert(const T& value) {
34+
auto v = static_cast<uint64_t>(value);
3435
char ret[3 * sizeof(T)];
3536
char* ptr = ret + 3 * sizeof(T) - 1;
3637
*ptr = '\0';
3738
const char* digits = "0123456789abcdef";
3839
do {
39-
unsigned digit = value & ((1 << BASE_BITS) - 1);
40+
unsigned digit = v & ((1 << BASE_BITS) - 1);
4041
*--ptr =
4142
(BASE_BITS < 4 ? static_cast<char>('0' + digit) : digits[digit]);
42-
} while ((value >>= BASE_BITS) != 0);
43+
} while ((v >>= BASE_BITS) != 0);
4344
return ptr;
4445
}
4546
template <unsigned BASE_BITS,
@@ -56,8 +57,8 @@ std::string ToString(const T& value) {
5657
}
5758

5859
template <unsigned BASE_BITS, typename T>
59-
std::string ToBaseString(T&& value) {
60-
return ToStringHelper::BaseConvert<BASE_BITS>(std::forward<T>(value));
60+
std::string ToBaseString(const T& value) {
61+
return ToStringHelper::BaseConvert<BASE_BITS>(value);
6162
}
6263

6364
inline std::string SPrintFImpl(const char* format) {

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.