fmt/fmt-bigendian_2.patch
Luigi Baldoni 05f4a8eecc - Added fmt-bigendian_1.patch, fmt-bigendian_2.patch,
fmt-bigendian_3.patch and fmt-bigendian_4.patch to fix tests
  on big endian targets

OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/fmt?expand=0&rev=12
2019-12-04 11:16:33 +00:00

26 lines
908 B
Diff

From aaf829bfb124fcd7953c33f38154027537efb072 Mon Sep 17 00:00:00 2001
From: Victor Zverovich <victor.zverovich@gmail.com>
Date: Fri, 29 Nov 2019 07:07:08 -0800
Subject: [PATCH] Fix fallback pointer formatting on big endian, take 2
---
include/fmt/format.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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
@@ -220,7 +220,10 @@ struct fallback_uintptr {
fallback_uintptr() = default;
explicit fallback_uintptr(const void* p) {
*this = bit_cast<fallback_uintptr>(p);
- if (is_big_endian()) std::memmove(value, value, sizeof(void*));
+ if (is_big_endian()) {
+ for (size_t i = 0, j = sizeof(void*) - 1; i < j; ++i, --j)
+ std::swap(value[i], value[j]);
+ }
}
};
#ifdef UINTPTR_MAX