| 1 |
From: Vcode2407 <[email protected]> |
| 2 |
Date: Tue, 16 Jun 2026 23:08:57 +0530 |
| 3 |
Subject: Fix fallback uint128 bitwise not |
| 4 |
|
| 5 |
Forwarded: not-needed |
| 6 |
Origin: https://github.com/fmtlib/fmt/pull/4813 |
| 7 |
|
| 8 |
Fix fallback uint128 bitwise not for 32-bit builds |
| 9 |
|
| 10 |
The fallback `detail::uint128` implementation is used when native |
| 11 |
`__int128` is unavailable, including i686 builds. |
| 12 |
|
| 13 |
`format_hexfloat` masks rounded bits with `~(inc - 1)`, but the |
| 14 |
fallback type did not define unary `operator~`, causing 32-bit |
| 15 |
builds to fail. |
| 16 |
|
| 17 |
This change restores the missing bitwise-not operator and adds |
| 18 |
regression coverage for the fallback `uint128` implementation. |
| 19 |
|
| 20 |
Tested: |
| 21 |
* x86_64 build |
| 22 |
* i686 build |
| 23 |
* `format-test --gtest_filter=uint128_test.*` |
| 24 |
|
| 25 |
Signed-off-by: YOKOTA Hiroshi <[email protected]> |
| 26 |
--- |
| 27 |
podofo/3rdparty/fmtlib/fmt/format.h | 3 +++ |
| 28 |
1 file changed, 3 insertions(+) |
| 29 |
|
| 30 |
diff --git a/podofo/3rdparty/fmtlib/fmt/format.h b/podofo/3rdparty/fmtlib/fmt/format.h |
| 31 |
index 5044bef..5706279 100644 |
| 32 |
--- a/podofo/3rdparty/fmtlib/fmt/format.h |
| 33 |
+++ b/podofo/3rdparty/fmtlib/fmt/format.h |
| 34 |
@@ -326,6 +326,9 @@ class uint128 { |
| 35 |
-> uint128 { |
| 36 |
return {lhs.hi_ & rhs.hi_, lhs.lo_ & rhs.lo_}; |
| 37 |
} |
| 38 |
+ friend constexpr auto operator~(const uint128& n) -> uint128 { |
| 39 |
+ return {~n.hi_, ~n.lo_}; |
| 40 |
+ } |
| 41 |
friend FMT_CONSTEXPR auto operator+(const uint128& lhs, const uint128& rhs) |
| 42 |
-> uint128 { |
| 43 |
auto result = uint128(lhs); |