[libcxx-commits] [libcxx] [libc++] Replace hardcoded table_size with CHAR_BIT calculation (PR #160008)
Fady Farag via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Sep 21 13:11:42 PDT 2025
https://github.com/iidmsa created https://github.com/llvm/llvm-project/pull/160008
Fix by computing table_size as 1 << CHAR_BIT instead of hardcoding 256.
>From 7767c34bff816f5e9d0deaffb5a48c3b275a1fee Mon Sep 17 00:00:00 2001
From: Fady Farag <com.idmsa at gmail.com>
Date: Sun, 21 Sep 2025 15:05:51 -0500
Subject: [PATCH] [libc++] Replace hardcoded table_size with CHAR_BIT
calculation
Fixes the FIXME in ctype<char> by computing table_size as
1 << CHAR_BIT instead of hardcoding 256.
---
libcxx/include/__cxx03/__locale | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/include/__cxx03/__locale b/libcxx/include/__cxx03/__locale
index 86160bcdcbd59..d30de94b127cf 100644
--- a/libcxx/include/__cxx03/__locale
+++ b/libcxx/include/__cxx03/__locale
@@ -578,7 +578,7 @@ public:
#ifdef _CACHED_RUNES
static const size_t table_size = _CACHED_RUNES;
#else
- static const size_t table_size = 256; // FIXME: Don't hardcode this.
+ static const size_t table_size = 1 << CHAR_BIT;
#endif
_LIBCPP_HIDE_FROM_ABI const mask* table() const _NOEXCEPT { return __tab_; }
static const mask* classic_table() _NOEXCEPT;
More information about the libcxx-commits
mailing list