[libcxx-commits] [libcxx] [libc++] Replace hardcoded table_size with CHAR_BIT calculation (PR #160008)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Sep 21 13:12:32 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Fady Farag (iidmsa)
<details>
<summary>Changes</summary>
Fix by computing table_size as 1 << CHAR_BIT instead of hardcoding 256.
---
Full diff: https://github.com/llvm/llvm-project/pull/160008.diff
1 Files Affected:
- (modified) libcxx/include/__cxx03/__locale (+1-1)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/160008
More information about the libcxx-commits
mailing list