[libc-commits] [libc] 8ae9c62 - [libc] Fix forward `constexpr` `add_with_carry` / `sub_with_borrow`
via libc-commits
libc-commits at lists.llvm.org
Thu Apr 4 04:19:46 PDT 2024
Author: Guillaume Chatelet
Date: 2024-04-04T13:19:43+02:00
New Revision: 8ae9c6259f833dce87f8d29402b1ddced90887b9
URL: https://github.com/llvm/llvm-project/commit/8ae9c6259f833dce87f8d29402b1ddced90887b9
DIFF: https://github.com/llvm/llvm-project/commit/8ae9c6259f833dce87f8d29402b1ddced90887b9.diff
LOG: [libc] Fix forward `constexpr` `add_with_carry` / `sub_with_borrow`
Introduced in #87613.
Added:
Modified:
libc/src/__support/math_extras.h
Removed:
################################################################################
diff --git a/libc/src/__support/math_extras.h b/libc/src/__support/math_extras.h
index bb6424bfa8e4d4..4bd87195740680 100644
--- a/libc/src/__support/math_extras.h
+++ b/libc/src/__support/math_extras.h
@@ -86,7 +86,7 @@ add_with_carry(T a, T b, T carry_in, T &carry_out) {
RETURN_IF(unsigned long long, __builtin_addcll)
#endif
}
- T sum;
+ T sum = {};
T carry1 = add_overflow(a, b, sum);
T carry2 = add_overflow(sum, carry_in, sum);
carry_out = carry1 | carry2;
@@ -112,7 +112,7 @@ sub_with_borrow(T a, T b, T carry_in, T &carry_out) {
RETURN_IF(unsigned long long, __builtin_subcll)
#endif
}
- T sub;
+ T sub = {};
T carry1 = sub_overflow(a, b, sub);
T carry2 = sub_overflow(sub, carry_in, sub);
carry_out = carry1 | carry2;
More information about the libc-commits
mailing list