[libcxx-commits] [libcxx] [libc++] Remove unnecessary division and modulo operations in bitset (PR #121312)
Peng Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Dec 29 18:38:00 PST 2024
https://github.com/winner245 created https://github.com/llvm/llvm-project/pull/121312
None
>From 4c4ebac6eed48ea054f004f8a1d72bc0a08b37d3 Mon Sep 17 00:00:00 2001
From: Peng Liu <winner245 at hotmail.com>
Date: Sun, 29 Dec 2024 21:36:48 -0500
Subject: [PATCH] Remove unnecessary division and modulo operations in bitset
---
libcxx/include/bitset | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libcxx/include/bitset b/libcxx/include/bitset
index 919d2a0f07e096..676d09d389c5d9 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -465,10 +465,10 @@ protected:
return const_reference(&__first_, __storage_type(1) << __pos);
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __iterator __make_iter(size_t __pos) _NOEXCEPT {
- return __iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);
+ return __iterator(&__first_, __pos);
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __const_iterator __make_iter(size_t __pos) const _NOEXCEPT {
- return __const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);
+ return __const_iterator(&__first_, __pos);
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset& __v) _NOEXCEPT;
More information about the libcxx-commits
mailing list