[libcxx-commits] [libcxx] [libc++] Remove redundant assignments in bitset string-like constructors (PR #121424)
Peng Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 31 21:01:13 PST 2024
https://github.com/winner245 created https://github.com/llvm/llvm-project/pull/121424
Assigning the high bits to zeroes at the end of string-like constructors (for C-style strings, `std::string`, and `std::string_view`) in `std::bitset` is truly redundant because the all bytes in underlying storage array have already been initialized to zeroes by default-constructor of the base class `__bitset`. This PR removes these redundant assignments.
>From c1a2de20a62cc90e31f6f59740d49b4ca1666f8e Mon Sep 17 00:00:00 2001
From: Peng Liu <winner245 at hotmail.com>
Date: Tue, 31 Dec 2024 23:46:50 -0500
Subject: [PATCH] Remove unnecessary zero-assignments in bitset string-like
constructors
---
libcxx/include/bitset | 1 -
1 file changed, 1 deletion(-)
diff --git a/libcxx/include/bitset b/libcxx/include/bitset
index 919d2a0f07e096..bae07b74f76b22 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -738,7 +738,6 @@ private:
_CharT __c = __str[__mp - 1 - __i];
(*this)[__i] = _Traits::eq(__c, __one);
}
- std::fill(__base::__make_iter(__i), __base::__make_iter(_Size), false);
}
_LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT { return __base::__hash_code(); }
More information about the libcxx-commits
mailing list