[libc-commits] [libc] [llvm] [libc][math] Refactor log2f to Header Only. (PR #176527)

via libc-commits libc-commits at lists.llvm.org
Sun Jan 25 05:07:44 PST 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- libc/shared/math/log2f.h libc/src/__support/math/log2f.h libc/shared/math.h libc/src/math/generic/log2f.cpp libc/test/shared/shared_math_test.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/src/__support/math/log2f.h b/libc/src/__support/math/log2f.h
index 7909440c2..53b3103d6 100644
--- a/libc/src/__support/math/log2f.h
+++ b/libc/src/__support/math/log2f.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_LIBC_SRC___SUPPORT_MATH_LOG2F_H
 #define LLVM_LIBC_SRC___SUPPORT_MATH_LOG2F_H
 
+#include "common_constants.h" // Lookup table for (1/f)
 #include "src/__support/FPUtil/FEnvImpl.h"
 #include "src/__support/FPUtil/FPBits.h"
 #include "src/__support/FPUtil/PolyEval.h"
@@ -16,8 +17,7 @@
 #include "src/__support/FPUtil/multiply_add.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
-#include "src/__support/macros/optimization.h"   // LIBC_UNLIKELY
-#include "common_constants.h" // Lookup table for (1/f)
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
 
 // This is a correctly-rounded algorithm for log2(x) in single precision with
 // round-to-nearest, tie-to-even mode from the RLIBM project at:

``````````

</details>


https://github.com/llvm/llvm-project/pull/176527


More information about the libc-commits mailing list