Skip to content

Commit 1218243

Browse files
committed
Fix arithmetic underflow
1 parent cc7d084 commit 1218243

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libcxx/include/__vector/vector_bool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class _LIBCPP_TEMPLATE_VIS vector<bool, _Allocator> {
115115
}
116116
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type
117117
__external_cap_to_internal(size_type __n) _NOEXCEPT {
118-
return (__n - 1) / __bits_per_word + 1;
118+
return (__n + __bits_per_word - 1) / __bits_per_word;
119119
}
120120

121121
public:

0 commit comments

Comments
 (0)