Add support for 96-bit long double

This commit is contained in:
Victor Zverovich
2022-02-18 17:59:02 -08:00
parent 2c8cd2db34
commit a0b43bfae2
4 changed files with 36 additions and 38 deletions

View File

@@ -340,16 +340,6 @@ TEST(format_impl_test, count_digits) {
test_count_digits<uint64_t>();
}
TEST(format_impl_test, write_uintptr_fallback) {
std::string s;
fmt::detail::write_ptr<char>(
std::back_inserter(s),
fmt::detail::to_uintptr<fmt::detail::uint128_fallback>(
reinterpret_cast<void*>(0xface)),
nullptr);
EXPECT_EQ(s, "0xface");
}
#ifdef _WIN32
# include <windows.h>
#endif

View File

@@ -1445,6 +1445,18 @@ TEST(format_test, format_pointer) {
EXPECT_EQ("0x0", fmt::format("{}", nullptr));
}
TEST(format_test, write_uintptr_fallback) {
// Test that formatting a pointer by converting it to uint128_fallback works.
// This is needed to support systems without uintptr_t.
auto s = std::string();
fmt::detail::write_ptr<char>(
std::back_inserter(s),
fmt::detail::bit_cast<fmt::detail::uint128_fallback>(
reinterpret_cast<void*>(0xface)),
nullptr);
EXPECT_EQ(s, "0xface");
}
enum class color { red, green, blue };
TEST(format_test, format_enum_class) {