Fix uint128 operator add (#1400)

* fix uint128 operator add for 64-bit hilo implemenation

* add uint128 test for operator add

* make clang happy

---------

Co-authored-by: Haicheng Wu <haichengw@nvidia.com>
This commit is contained in:
reed
2024-04-02 13:32:18 -04:00
committed by GitHub
co-authored by Haicheng Wu
parent f9ece1b42c
commit 19f3cc33f1
3 changed files with 123 additions and 1 deletions
+1 -1
View File
@@ -138,7 +138,7 @@ struct alignas(16) uint128_t
y.native = native + rhs.native;
#else
y.hilo_.lo = hilo_.lo + rhs.hilo_.lo;
y.hilo_.hi = hilo_.hi + rhs.hilo_.hi + (!y.hilo_.lo && (rhs.hilo_.lo));
y.hilo_.hi = hilo_.hi + rhs.hilo_.hi + (y.hilo_.lo < hilo_.lo);
#endif
return y;
}