Luigi Baldoni
093c9ccab8
fix big endian build OBS-URL: https://build.opensuse.org/request/show/752684 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/fmt?expand=0&rev=10
39 lines
1.6 KiB
Diff
39 lines
1.6 KiB
Diff
From ba6e330fd3a9c2d859d651c59d6206620940a265 Mon Sep 17 00:00:00 2001
|
|
From: Victor Zverovich <victor.zverovich@gmail.com>
|
|
Date: Sat, 30 Nov 2019 08:19:58 -0800
|
|
Subject: [PATCH] digits -> num_bits
|
|
|
|
---
|
|
include/fmt/format.h | 9 +++++----
|
|
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
|
|
Index: fmt-6.0.0/include/fmt/format.h
|
|
===================================================================
|
|
--- fmt-6.0.0.orig/include/fmt/format.h
|
|
+++ fmt-6.0.0/include/fmt/format.h
|
|
@@ -281,11 +281,12 @@ template <typename Container>
|
|
inline typename Container::value_type* get_data(Container& c) {
|
|
return c.data();
|
|
}
|
|
-template <typename T> constexpr int digits() {
|
|
+template <typename T> constexpr int num_bits() {
|
|
return std::numeric_limits<T>::digits;
|
|
}
|
|
-template <> constexpr int digits<fallback_uintptr>() {
|
|
- return sizeof(void*) * std::numeric_limits<unsigned char>::digits;
|
|
+template <> constexpr int num_bits<fallback_uintptr>() {
|
|
+ return static_cast<int>(sizeof(void*) *
|
|
+ std::numeric_limits<unsigned char>::digits);
|
|
}
|
|
|
|
#ifdef _SECURE_SCL
|
|
@@ -906,7 +907,7 @@ Char* format_uint(Char* buffer, internal
|
|
template <unsigned BASE_BITS, typename Char, typename It, typename UInt>
|
|
inline It format_uint(It out, UInt value, int num_digits, bool upper = false) {
|
|
// Buffer should be large enough to hold all digits (digits / BASE_BITS + 1).
|
|
- char buffer[digits<UInt>() / BASE_BITS + 1];
|
|
+ char buffer[num_bits<UInt>() / BASE_BITS + 1];
|
|
format_uint<BASE_BITS>(buffer, value, num_digits, upper);
|
|
return internal::copy_str<Char>(buffer, buffer + num_digits, out);
|
|
}
|