[PATCH] [Support] Add BitHacks.h - generic bit utility functions.

Michael Spencer bigcheesegs at gmail.com
Tue May 21 23:07:02 PDT 2013



================
Comment at: include/llvm/Support/BitHacks.h:24
@@ +23,3 @@
+namespace bit {
+enum ZeroBehaivor {
+  ZB_Undefined,
----------------
Rui Ueyama wrote:
> Add comments on these enums.
k

================
Comment at: include/llvm/Support/BitHacks.h:30
@@ +29,3 @@
+
+/// \brief Count number of zeros from the least significant bit to the most.
+template <typename T>
----------------
Shankar Kalpathi Easwaran wrote:
> may need more documentation since this would be used as an API for lot of components.
k

================
Comment at: include/llvm/Support/BitHacks.h:55
@@ +54,3 @@
+
+// Disable signed.
+template <typename T>
----------------
Shankar Kalpathi Easwaran wrote:
> Why disabling signed ?
Because the representation of signed values in C++ is implementation defined. The generic algorithms here won't work with signed types (numeric_limits<T>::digits is not a power of two, and the shift introduces undefined/implementation defined behavior/value for negative values).


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



More information about the llvm-commits mailing list