mirror of
https://github.com/fmtlib/fmt.git
synced 2026-07-30 16:26:27 +08:00
Fix fallback uint128 bitwise not (#4813)
This commit is contained in:
parent
979c94dff8
commit
588b3a0f8f
@ -326,6 +326,9 @@ class uint128 {
|
||||
-> uint128 {
|
||||
return {lhs.hi_ & rhs.hi_, lhs.lo_ & rhs.lo_};
|
||||
}
|
||||
friend constexpr auto operator~(const uint128& n) -> uint128 {
|
||||
return {~n.hi_, ~n.lo_};
|
||||
}
|
||||
friend FMT_CONSTEXPR auto operator+(const uint128& lhs, const uint128& rhs)
|
||||
-> uint128 {
|
||||
auto result = uint128(lhs);
|
||||
|
||||
@ -82,6 +82,11 @@ TEST(uint128_test, minus) {
|
||||
EXPECT_EQ(n - 2, 40);
|
||||
}
|
||||
|
||||
TEST(uint128_test, bitwise_not) {
|
||||
auto n = ~uint128(0x123456789abcdef0, 0x0fedcba987654321);
|
||||
EXPECT_EQ(n, uint128(0xedcba9876543210f, 0xf0123456789abcde));
|
||||
}
|
||||
|
||||
TEST(uint128_test, plus_assign) {
|
||||
auto n = uint128(32);
|
||||
n += uint128(10);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user