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

Rui Ueyama ruiu at google.com
Wed May 22 13:51:15 PDT 2013



================
Comment at: include/llvm/Support/MathExtras.h:171
@@ +170,3 @@
+///
+/// \param ZB the behaivor on an input of 0. Only ZB_Width and ZB_Undefined are
+///   valid arguments.
----------------
Typo? ZB_Width -> ZB_Max

================
Comment at: include/llvm/Support/MathExtras.h:194
@@ +193,3 @@
+///
+/// \param ZB the behaivor on an input of 0. Only ZB_Width and ZB_Undefined are
+///   valid arguments.
----------------
Ditto

================
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;
----------------
You can return any value for ZB_Undefined. Why don't you check only Val?


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



More information about the llvm-commits mailing list