Skip to content

Commit 853fe17

Browse files
committed
Address philnik777's comment regarding ABI
1 parent 975084a commit 853fe17

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libcxx/include/bitset

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void __bitset<_N_words, _Siz
329329
for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
330330
*__p = ~*__p;
331331
// do last partial word
332+
// Ensure trailing padding bits are zeroed as part of the ABI for consistent hashing behavior. std::hash<bitset>
333+
// assumes trailing bits are zeroed; otherwise, identical bitsets could hash differently.
332334
if (__n > 0)
333335
*__p ^= (__storage_type(1) << __n) - 1;
334336
}

0 commit comments

Comments
 (0)