[libc-commits] [libc] [libc][stdbit][c23] fixes typos in bit_width, bit_floor C type-generic macros (PR #84659)

Michael Flanders via libc-commits libc-commits at lists.llvm.org
Sat Mar 9 16:01:22 PST 2024


https://github.com/Flandini created https://github.com/llvm/llvm-project/pull/84659

Fixes #84658.

Assuming these were typos in the first place.

I am unsure of the best way to ensure that both sides of the preprocessor condition in `libc/include/llvm-libc-macros/stdbit-macros.h` are tested. Could someone point me in the right direction for adding test coverage to the non `__cplusplus` branch? Or maybe it is being tested and I've missed it.

>From a3a05ea2ba169f1140a5f7f741b3c38c475162ce Mon Sep 17 00:00:00 2001
From: Michael Flanders <mkf727 at cs.washington.edu>
Date: Sat, 9 Mar 2024 23:57:57 +0000
Subject: [PATCH] [libc][stdbit][c23] fixes typos in bit_width, bit_floor C
 type-generic macros

---
 libc/include/llvm-libc-macros/stdbit-macros.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/include/llvm-libc-macros/stdbit-macros.h b/libc/include/llvm-libc-macros/stdbit-macros.h
index 5b51068f866b71..e3eb6630afddb6 100644
--- a/libc/include/llvm-libc-macros/stdbit-macros.h
+++ b/libc/include/llvm-libc-macros/stdbit-macros.h
@@ -274,14 +274,14 @@ inline unsigned long long stdc_bit_floor(unsigned long long x) {
       unsigned long long: stdc_has_single_bit_ull)(x)
 #define stdc_bit_width(x)                                                      \
   _Generic((x),                                                                \
-      unsigned char: stdc_bit_width_ui,                                        \
+      unsigned char: stdc_bit_width_uc,                                        \
       unsigned short: stdc_bit_width_us,                                       \
       unsigned: stdc_bit_width_ui,                                             \
       unsigned long: stdc_bit_width_ul,                                        \
       unsigned long long: stdc_bit_width_ull)(x)
 #define stdc_bit_floor(x)                                                      \
   _Generic((x),                                                                \
-      unsigned char: stdc_bit_floor_ui,                                        \
+      unsigned char: stdc_bit_floor_uc,                                        \
       unsigned short: stdc_bit_floor_us,                                       \
       unsigned: stdc_bit_floor_ui,                                             \
       unsigned long: stdc_bit_floor_ul,                                        \



More information about the libc-commits mailing list