[libc-commits] [libc] [libc][stdfix] Implement `countlsfx` functions in libc. (PR #126597)
via libc-commits
libc-commits at lists.llvm.org
Mon Feb 10 12:55:06 PST 2025
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 d11b9b7275b01067ff15486caf1e270375e1a97c 88e9b63318d2611b5aa6cc66a4bb7ecdc63bd90a --extensions h,cpp -- libc/src/stdfix/countlshk.cpp libc/src/stdfix/countlshk.h libc/src/stdfix/countlshr.cpp libc/src/stdfix/countlshr.h libc/src/stdfix/countlsk.cpp libc/src/stdfix/countlsk.h libc/src/stdfix/countlslk.cpp libc/src/stdfix/countlslk.h libc/src/stdfix/countlslr.cpp libc/src/stdfix/countlslr.h libc/src/stdfix/countlsr.cpp libc/src/stdfix/countlsr.h libc/src/stdfix/countlsuhk.cpp libc/src/stdfix/countlsuhk.h libc/src/stdfix/countlsuhr.cpp libc/src/stdfix/countlsuhr.h libc/src/stdfix/countlsuk.cpp libc/src/stdfix/countlsuk.h libc/src/stdfix/countlsulk.cpp libc/src/stdfix/countlsulk.h libc/src/stdfix/countlsulr.cpp libc/src/stdfix/countlsulr.h libc/src/stdfix/countlsur.cpp libc/src/stdfix/countlsur.h libc/test/src/stdfix/CountlsTest.h libc/test/src/stdfix/countlshk_test.cpp libc/test/src/stdfix/countlshr_test.cpp libc/test/src/stdfix/countlsk_test.cpp libc/test/src/stdfix/countlslk_test.cpp libc/test/src/stdfix/countlslr_test.cpp libc/test/src/stdfix/countlsr_test.cpp libc/test/src/stdfix/countlsuhk_test.cpp libc/test/src/stdfix/countlsuhr_test.cpp libc/test/src/stdfix/countlsuk_test.cpp libc/test/src/stdfix/countlsulk_test.cpp libc/test/src/stdfix/countlsulr_test.cpp libc/test/src/stdfix/countlsur_test.cpp libc/src/__support/fixed_point/fx_bits.h libc/src/__support/fixed_point/fx_rep.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libc/src/__support/fixed_point/fx_rep.h b/libc/src/__support/fixed_point/fx_rep.h
index ca9fafddc4..7227fffa68 100644
--- a/libc/src/__support/fixed_point/fx_rep.h
+++ b/libc/src/__support/fixed_point/fx_rep.h
@@ -43,10 +43,8 @@ template <> struct FXRep<short fract> {
LIBC_INLINE_VAR static constexpr int SIGN_LEN = 1;
LIBC_INLINE_VAR static constexpr int INTEGRAL_LEN = 0;
LIBC_INLINE_VAR static constexpr int FRACTION_LEN = SFRACT_FBIT;
- LIBC_INLINE_VAR static constexpr int VALUE_LEN =
- INTEGRAL_LEN + FRACTION_LEN;
- LIBC_INLINE_VAR static constexpr int TOTAL_LEN =
- SIGN_LEN + VALUE_LEN;
+ LIBC_INLINE_VAR static constexpr int VALUE_LEN = INTEGRAL_LEN + FRACTION_LEN;
+ LIBC_INLINE_VAR static constexpr int TOTAL_LEN = SIGN_LEN + VALUE_LEN;
LIBC_INLINE static constexpr Type MIN() { return SFRACT_MIN; }
LIBC_INLINE static constexpr Type MAX() { return SFRACT_MAX; }
@@ -65,10 +63,8 @@ template <> struct FXRep<unsigned short fract> {
LIBC_INLINE_VAR static constexpr int SIGN_LEN = 0;
LIBC_INLINE_VAR static constexpr int INTEGRAL_LEN = 0;
LIBC_INLINE_VAR static constexpr int FRACTION_LEN = USFRACT_FBIT;
- LIBC_INLINE_VAR static constexpr int VALUE_LEN =
- INTEGRAL_LEN + FRACTION_LEN;
- LIBC_INLINE_VAR static constexpr int TOTAL_LEN =
- SIGN_LEN + VALUE_LEN;
+ LIBC_INLINE_VAR static constexpr int VALUE_LEN = INTEGRAL_LEN + FRACTION_LEN;
+ LIBC_INLINE_VAR static constexpr int TOTAL_LEN = SIGN_LEN + VALUE_LEN;
LIBC_INLINE static constexpr Type MIN() { return USFRACT_MIN; }
LIBC_INLINE static constexpr Type MAX() { return USFRACT_MAX; }
@@ -87,10 +83,8 @@ template <> struct FXRep<fract> {
LIBC_INLINE_VAR static constexpr int SIGN_LEN = 1;
LIBC_INLINE_VAR static constexpr int INTEGRAL_LEN = 0;
LIBC_INLINE_VAR static constexpr int FRACTION_LEN = FRACT_FBIT;
- LIBC_INLINE_VAR static constexpr int VALUE_LEN =
- INTEGRAL_LEN + FRACTION_LEN;
- LIBC_INLINE_VAR static constexpr int TOTAL_LEN =
- SIGN_LEN + VALUE_LEN;
+ LIBC_INLINE_VAR static constexpr int VALUE_LEN = INTEGRAL_LEN + FRACTION_LEN;
+ LIBC_INLINE_VAR static constexpr int TOTAL_LEN = SIGN_LEN + VALUE_LEN;
LIBC_INLINE static constexpr Type MIN() { return FRACT_MIN; }
LIBC_INLINE static constexpr Type MAX() { return FRACT_MAX; }
@@ -109,10 +103,8 @@ template <> struct FXRep<unsigned fract> {
LIBC_INLINE_VAR static constexpr int SIGN_LEN = 0;
LIBC_INLINE_VAR static constexpr int INTEGRAL_LEN = 0;
LIBC_INLINE_VAR static constexpr int FRACTION_LEN = UFRACT_FBIT;
- LIBC_INLINE_VAR static constexpr int VALUE_LEN =
- INTEGRAL_LEN + FRACTION_LEN;
- LIBC_INLINE_VAR static constexpr int TOTAL_LEN =
- SIGN_LEN + VALUE_LEN;
+ LIBC_INLINE_VAR static constexpr int VALUE_LEN = INTEGRAL_LEN + FRACTION_LEN;
+ LIBC_INLINE_VAR static constexpr int TOTAL_LEN = SIGN_LEN + VALUE_LEN;
LIBC_INLINE static constexpr Type MIN() { return UFRACT_MIN; }
LIBC_INLINE static constexpr Type MAX() { return UFRACT_MAX; }
@@ -131,10 +123,8 @@ template <> struct FXRep<long fract> {
LIBC_INLINE_VAR static constexpr int SIGN_LEN = 1;
LIBC_INLINE_VAR static constexpr int INTEGRAL_LEN = 0;
LIBC_INLINE_VAR static constexpr int FRACTION_LEN = LFRACT_FBIT;
- LIBC_INLINE_VAR static constexpr int VALUE_LEN =
- INTEGRAL_LEN + FRACTION_LEN;
- LIBC_INLINE_VAR static constexpr int TOTAL_LEN =
- SIGN_LEN + VALUE_LEN;
+ LIBC_INLINE_VAR static constexpr int VALUE_LEN = INTEGRAL_LEN + FRACTION_LEN;
+ LIBC_INLINE_VAR static constexpr int TOTAL_LEN = SIGN_LEN + VALUE_LEN;
LIBC_INLINE static constexpr Type MIN() { return LFRACT_MIN; }
LIBC_INLINE static constexpr Type MAX() { return LFRACT_MAX; }
@@ -153,10 +143,8 @@ template <> struct FXRep<unsigned long fract> {
LIBC_INLINE_VAR static constexpr int SIGN_LEN = 0;
LIBC_INLINE_VAR static constexpr int INTEGRAL_LEN = 0;
LIBC_INLINE_VAR static constexpr int FRACTION_LEN = ULFRACT_FBIT;
- LIBC_INLINE_VAR static constexpr int VALUE_LEN =
- INTEGRAL_LEN + FRACTION_LEN;
- LIBC_INLINE_VAR static constexpr int TOTAL_LEN =
- SIGN_LEN + VALUE_LEN;
+ LIBC_INLINE_VAR static constexpr int VALUE_LEN = INTEGRAL_LEN + FRACTION_LEN;
+ LIBC_INLINE_VAR static constexpr int TOTAL_LEN = SIGN_LEN + VALUE_LEN;
LIBC_INLINE static constexpr Type MIN() { return ULFRACT_MIN; }
LIBC_INLINE static constexpr Type MAX() { return ULFRACT_MAX; }
@@ -175,10 +163,8 @@ template <> struct FXRep<short accum> {
LIBC_INLINE_VAR static constexpr int SIGN_LEN = 1;
LIBC_INLINE_VAR static constexpr int INTEGRAL_LEN = SACCUM_IBIT;
LIBC_INLINE_VAR static constexpr int FRACTION_LEN = SACCUM_FBIT;
- LIBC_INLINE_VAR static constexpr int VALUE_LEN =
- INTEGRAL_LEN + FRACTION_LEN;
- LIBC_INLINE_VAR static constexpr int TOTAL_LEN =
- SIGN_LEN + VALUE_LEN;
+ LIBC_INLINE_VAR static constexpr int VALUE_LEN = INTEGRAL_LEN + FRACTION_LEN;
+ LIBC_INLINE_VAR static constexpr int TOTAL_LEN = SIGN_LEN + VALUE_LEN;
LIBC_INLINE static constexpr Type MIN() { return SACCUM_MIN; }
LIBC_INLINE static constexpr Type MAX() { return SACCUM_MAX; }
@@ -197,10 +183,8 @@ template <> struct FXRep<unsigned short accum> {
LIBC_INLINE_VAR static constexpr int SIGN_LEN = 0;
LIBC_INLINE_VAR static constexpr int INTEGRAL_LEN = USACCUM_IBIT;
LIBC_INLINE_VAR static constexpr int FRACTION_LEN = USACCUM_FBIT;
- LIBC_INLINE_VAR static constexpr int VALUE_LEN =
- INTEGRAL_LEN + FRACTION_LEN;
- LIBC_INLINE_VAR static constexpr int TOTAL_LEN =
- SIGN_LEN + VALUE_LEN;
+ LIBC_INLINE_VAR static constexpr int VALUE_LEN = INTEGRAL_LEN + FRACTION_LEN;
+ LIBC_INLINE_VAR static constexpr int TOTAL_LEN = SIGN_LEN + VALUE_LEN;
LIBC_INLINE static constexpr Type MIN() { return USACCUM_MIN; }
LIBC_INLINE static constexpr Type MAX() { return USACCUM_MAX; }
@@ -219,10 +203,8 @@ template <> struct FXRep<accum> {
LIBC_INLINE_VAR static constexpr int SIGN_LEN = 1;
LIBC_INLINE_VAR static constexpr int INTEGRAL_LEN = ACCUM_IBIT;
LIBC_INLINE_VAR static constexpr int FRACTION_LEN = ACCUM_FBIT;
- LIBC_INLINE_VAR static constexpr int VALUE_LEN =
- INTEGRAL_LEN + FRACTION_LEN;
- LIBC_INLINE_VAR static constexpr int TOTAL_LEN =
- SIGN_LEN + VALUE_LEN;
+ LIBC_INLINE_VAR static constexpr int VALUE_LEN = INTEGRAL_LEN + FRACTION_LEN;
+ LIBC_INLINE_VAR static constexpr int TOTAL_LEN = SIGN_LEN + VALUE_LEN;
LIBC_INLINE static constexpr Type MIN() { return ACCUM_MIN; }
LIBC_INLINE static constexpr Type MAX() { return ACCUM_MAX; }
@@ -241,10 +223,8 @@ template <> struct FXRep<unsigned accum> {
LIBC_INLINE_VAR static constexpr int SIGN_LEN = 0;
LIBC_INLINE_VAR static constexpr int INTEGRAL_LEN = UACCUM_IBIT;
LIBC_INLINE_VAR static constexpr int FRACTION_LEN = UACCUM_FBIT;
- LIBC_INLINE_VAR static constexpr int VALUE_LEN =
- INTEGRAL_LEN + FRACTION_LEN;
- LIBC_INLINE_VAR static constexpr int TOTAL_LEN =
- SIGN_LEN + VALUE_LEN;
+ LIBC_INLINE_VAR static constexpr int VALUE_LEN = INTEGRAL_LEN + FRACTION_LEN;
+ LIBC_INLINE_VAR static constexpr int TOTAL_LEN = SIGN_LEN + VALUE_LEN;
LIBC_INLINE static constexpr Type MIN() { return UACCUM_MIN; }
LIBC_INLINE static constexpr Type MAX() { return UACCUM_MAX; }
@@ -263,10 +243,8 @@ template <> struct FXRep<long accum> {
LIBC_INLINE_VAR static constexpr int SIGN_LEN = 1;
LIBC_INLINE_VAR static constexpr int INTEGRAL_LEN = LACCUM_IBIT;
LIBC_INLINE_VAR static constexpr int FRACTION_LEN = LACCUM_FBIT;
- LIBC_INLINE_VAR static constexpr int VALUE_LEN =
- INTEGRAL_LEN + FRACTION_LEN;
- LIBC_INLINE_VAR static constexpr int TOTAL_LEN =
- SIGN_LEN + VALUE_LEN;
+ LIBC_INLINE_VAR static constexpr int VALUE_LEN = INTEGRAL_LEN + FRACTION_LEN;
+ LIBC_INLINE_VAR static constexpr int TOTAL_LEN = SIGN_LEN + VALUE_LEN;
LIBC_INLINE static constexpr Type MIN() { return LACCUM_MIN; }
LIBC_INLINE static constexpr Type MAX() { return LACCUM_MAX; }
@@ -285,10 +263,8 @@ template <> struct FXRep<unsigned long accum> {
LIBC_INLINE_VAR static constexpr int SIGN_LEN = 0;
LIBC_INLINE_VAR static constexpr int INTEGRAL_LEN = ULACCUM_IBIT;
LIBC_INLINE_VAR static constexpr int FRACTION_LEN = ULACCUM_FBIT;
- LIBC_INLINE_VAR static constexpr int VALUE_LEN =
- INTEGRAL_LEN + FRACTION_LEN;
- LIBC_INLINE_VAR static constexpr int TOTAL_LEN =
- SIGN_LEN + VALUE_LEN;
+ LIBC_INLINE_VAR static constexpr int VALUE_LEN = INTEGRAL_LEN + FRACTION_LEN;
+ LIBC_INLINE_VAR static constexpr int TOTAL_LEN = SIGN_LEN + VALUE_LEN;
LIBC_INLINE static constexpr Type MIN() { return ULACCUM_MIN; }
LIBC_INLINE static constexpr Type MAX() { return ULACCUM_MAX; }
``````````
</details>
https://github.com/llvm/llvm-project/pull/126597
More information about the libc-commits
mailing list