[PATCH] D33588: Fix two sources of UB in __next_hash_pow2 (from __hash_table)

Marshall Clow via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 2 17:09:21 PDT 2017


mclow.lists accepted this revision.
mclow.lists added inline comments.
This revision is now accepted and ready to land.


================
Comment at: include/__hash_table:140
+    return (__n > 1) ? (size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1))) : __n;
 }
 
----------------
I turned the condition around, and commtted this as r304617:

     return __n < 2 ? __n : (size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1)));



https://reviews.llvm.org/D33588





More information about the cfe-commits mailing list