Add class loading infrastructure.
Change-Id: I94bdabcefdf1030ee1827d9219eaf60e4dc818ca
diff --git a/src/utils.h b/src/utils.h
index a8bf3e7..bf8896d 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -60,6 +60,18 @@
}
// Implementation is from "Hacker's Delight" by Henry S. Warren, Jr.,
+// figure 3-3, page 48, where the function is called clp2.
+static inline uint32_t RoundUpToPowerOfTwo(uint32_t x) {
+ x = x - 1;
+ x = x | (x >> 1);
+ x = x | (x >> 2);
+ x = x | (x >> 4);
+ x = x | (x >> 8);
+ x = x | (x >> 16);
+ return x + 1;
+}
+
+// Implementation is from "Hacker's Delight" by Henry S. Warren, Jr.,
// figure 5-2, page 66, where the function is called pop.
static inline int CountOneBits(uint32_t x) {
x = x - ((x >> 1) & 0x55555555);