[libc-commits] [libc] [llvm] [libc][math] Refactor ilogb implementation to header-only in src/__support/math folder. (PR #175504)

via libc-commits libc-commits at lists.llvm.org
Fri Jan 16 21:32:08 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 h,cpp -- libc/shared/math/ilogb.h libc/src/__support/math/ilogb.h libc/shared/math.h libc/src/math/generic/ilogb.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/shared/math.h b/libc/shared/math.h
index 05710749c..1eb624942 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -61,7 +61,6 @@
 #include "math/frexpf.h"
 #include "math/frexpf128.h"
 #include "math/frexpf16.h"
-#include "math/ilogb.h"
 #include "math/fsqrt.h"
 #include "math/fsqrtf128.h"
 #include "math/hypotf.h"
diff --git a/libc/src/__support/math/ilogb.h b/libc/src/__support/math/ilogb.h
index 1da81c34a..89b90f192 100644
--- a/libc/src/__support/math/ilogb.h
+++ b/libc/src/__support/math/ilogb.h
@@ -17,7 +17,9 @@ namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static constexpr int ilogb(double x) { return fputil::intlogb<int>(x); }
+LIBC_INLINE static constexpr int ilogb(double x) {
+  return fputil::intlogb<int>(x);
+}
 
 } // namespace math
 

``````````

</details>


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


More information about the libc-commits mailing list