ConcurrentHashMap: Rehash only when expanding
Summary: Fixes a bug when a call to reserve leads to calling rehash with a buck_count value that is not a power of two and/or less than the current count. The rehash algorithm depends on the bucket_count being a power of two and that the count does not decrease. The fix: Ensure that reserve calls rehash with a power of two argument and that rehash is skipped if the new count is not greater than the old one. Reviewed By: davidtgoldblatt Differential Revision: D25852794 fbshipit-source-id: ae1ae6cfbcbd0659becc14c703920e9505181109
Showing
Please register or sign in to comment