[libc-commits] [PATCH] D118173: [libc] Refactor sqrt implementations and add tests for generic sqrt implementations.
Tue Ly via Phabricator via libc-commits
libc-commits at lists.llvm.org
Tue Jan 25 17:46:10 PST 2022
lntue marked 2 inline comments as done.
lntue added inline comments.
================
Comment at: libc/src/__support/FPUtil/generic/sqrt.h:115
+ return x86::sqrt(x);
+ } else {
+ // IEEE floating points formats.
----------------
michaelrj wrote:
> this else is unnecessary, since the only other branch returns. In addition, the other branch doesn't need braces, since it only has one line.
This `else` is actually necessary, since this is an `if constexpr` expression, which is a more C++ friendly version of `#if #else #endif`. Without enclosing the entire following part inside else { }, the compiler will put them in for x86 long double, and then generate a ton of warnings and errors, even though they are dead codes due to the return from the if clause.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118173/new/
https://reviews.llvm.org/D118173
More information about the libc-commits
mailing list