[PATCH] [Support] Add type generic bit utilities to MathExtras.h

Michael Spencer bigcheesegs at gmail.com
Wed May 22 14:38:34 PDT 2013



================
Comment at: include/llvm/Support/MathExtras.h:77
@@ +76,3 @@
+inline std::size_t countTrailingZeros<uint32_t>(uint32_t Val, ZeroBehaivor ZB) {
+  if (ZB != ZB_Undefined && Val == 0)
+    return 32;
----------------
Rui Ueyama wrote:
> You can return any value for ZB_Undefined. Why don't you check only Val?
Because we don't want the check when ZB_Undefined is passed. We get a single (bsf on x86) instruction in that case.


http://llvm-reviews.chandlerc.com/D841



More information about the llvm-commits mailing list