From 0e3a508af4f97f4091db7b03ab7c4c5b0834a4ce Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Mon, 8 Jan 2018 22:57:12 +0000 Subject: [PATCH] Revert "Make rehash(0) work with ubsan's unsigned-integer-overflow." Seems to have broken some tests since I first wrote this a while back. Will reland after checking what went wrong with the tests. This reverts commit 7023194c8d11a081fd01ed25308b3d60193c6a06. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322039 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__hash_table | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/__hash_table b/include/__hash_table index 239415231..3f430af12 100644 --- a/include/__hash_table +++ b/include/__hash_table @@ -2136,7 +2136,7 @@ template void __hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n) { - if (__n < 2) + if (__n == 1) __n = 2; else if (__n & (__n - 1)) __n = __next_prime(__n);