[libc-commits] [libc] [libc][stdfix] Fix buildbot failure because of a typo. (PR #126291)

Krishna Pandey via libc-commits libc-commits at lists.llvm.org
Fri Feb 7 11:43:26 PST 2025


https://github.com/krishna2803 updated https://github.com/llvm/llvm-project/pull/126291

>From 11fe65a8b579a10a6f2da3cefda3886af06a8840 Mon Sep 17 00:00:00 2001
From: krishna2803 <kpandey81930 at gmail.com>
Date: Sat, 8 Feb 2025 00:47:33 +0530
Subject: [PATCH 1/2] fix: buildbot failure

---
 libc/src/__support/fixed_point/fx_bits.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/src/__support/fixed_point/fx_bits.h b/libc/src/__support/fixed_point/fx_bits.h
index 21985e644253441..b9c065a3226d1c0 100644
--- a/libc/src/__support/fixed_point/fx_bits.h
+++ b/libc/src/__support/fixed_point/fx_bits.h
@@ -188,8 +188,8 @@ countls(T f) {
   constexpr int PADDING_LEN = CONTAIN_LEN - FXRep::TOTAL_LEN;
 
   if constexpr (FXRep::SIGN_LEN != 0) {
-    if (x < 0)
-      x = bit_not(x);
+    if (f < 0)
+      f = bit_not(f);
   }
 
   BitType value_bits = FXBits(x)::get_bits();

>From caa32e6e67e9be05a5e4a317e92209df69173bcd Mon Sep 17 00:00:00 2001
From: krishna2803 <kpandey81930 at gmail.com>
Date: Sat, 8 Feb 2025 01:12:58 +0530
Subject: [PATCH 2/2] fix: change to single line if for countls and change x to
 f (typo)

---
 libc/src/__support/fixed_point/fx_bits.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libc/src/__support/fixed_point/fx_bits.h b/libc/src/__support/fixed_point/fx_bits.h
index b9c065a3226d1c0..4b87a9018d67089 100644
--- a/libc/src/__support/fixed_point/fx_bits.h
+++ b/libc/src/__support/fixed_point/fx_bits.h
@@ -187,12 +187,11 @@ countls(T f) {
   constexpr int CONTAIN_LEN = cpp::numeric_limits<BitType>::digits;
   constexpr int PADDING_LEN = CONTAIN_LEN - FXRep::TOTAL_LEN;
 
-  if constexpr (FXRep::SIGN_LEN != 0) {
+  if constexpr (FXRep::SIGN_LEN != 0)
     if (f < 0)
       f = bit_not(f);
-  }
 
-  BitType value_bits = FXBits(x)::get_bits();
+  BitType value_bits = FXBits(f)::get_bits();
   return cpp::countl_zero(value_bits) - PADDING_LEN;
 }
 



More information about the libc-commits mailing list