On Mon, Aug 20, 2012 at 06:58:43PM -0700, Ethan Jackson wrote:
> All your comments make sense, thanks.
>
> > I really wanted this to be inline with GCC, since function call
> > overhead for a single machine instruction is nasty. Anyhow, you're
> > right, it deserves to be in util, and so I removed the raw_ctz() code
> > from flow.c and slipped in the following patch before this one:
>
> My only comment in this patch, is that it may make sense to inline
> ctz() as well given how simple it is.
Fair enough. I folded in this incremental:
diff --git a/lib/util.c b/lib/util.c
index d0ff872..c90d556 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -819,13 +819,6 @@ raw_ctz(uint32_t n)
}
#endif
-/* Returns the number of trailing 0-bits in 'n', or 32 if 'n' is 0. */
-int
-ctz(uint32_t n)
-{
- return n ? raw_ctz(n) : 32;
-}
-
/* Returns the number of 1-bits in 'x', between 0 and 32 inclusive. */
int
popcount(uint32_t x)
diff --git a/lib/util.h b/lib/util.h
index f394673..a1f4bd7 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -259,9 +259,15 @@ raw_ctz(uint32_t n)
int raw_ctz(uint32_t n);
#endif
+/* Returns the number of trailing 0-bits in 'n', or 32 if 'n' is 0. */
+static inline int
+ctz(uint32_t n)
+{
+ return n ? raw_ctz(n) : 32;
+}
+
int log_2_floor(uint32_t);
int log_2_ceil(uint32_t);
-int ctz(uint32_t);
int popcount(uint32_t);
bool is_all_zeros(const uint8_t *, size_t);
Thank you for the comments.
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev