Skip to content

Commit

Permalink
Fix write_uintptr_fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Jan 10, 2024
1 parent 7259929 commit 401f087
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ template <typename T> constexpr auto num_bits() -> int {
}
// std::numeric_limits<T>::digits may return 0 for 128-bit ints.
template <> constexpr auto num_bits<int128_opt>() -> int { return 128; }
template <> constexpr auto num_bits<uint128_t>() -> int { return 128; }
template <> constexpr auto num_bits<uint128_fallback>() -> int { return 128; }

// A heterogeneous bit_cast used for converting 96-bit long double to uint128_t
// and 128-bit pointers to uint128_fallback.
Expand Down
5 changes: 2 additions & 3 deletions test/format-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1561,14 +1561,13 @@ TEST(format_test, format_pointer) {
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.
// TODO
/*auto s = std::string();
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");*/
EXPECT_EQ(s, "0xface");
}

enum class color { red, green, blue };
Expand Down

0 comments on commit 401f087

Please sign in to comment.