On Fri, Oct 26, 2012 at 11:36:06AM +0900, Simon Horman wrote: > Make use of __builtin_clz if available which should optimize > ofputil_version_bitmap_scanr() by replacing a loop with > a single CLZ instruction when available. > > I'm unsure if this approach is worth it or not. > But a similar approach could be taken to use ffs() > in bitmap_scan(). > > Signed-off-by: Simon Horman <ho...@verge.net.au>
I didn't notice this until now; I see now that I implemented something with the same purpose as: /* Returns the index of the rightmost 1-bit in 'x' (e.g. 01011000 => 6), or 32 * if 'x' is 0. * * This function only works with 32-bit integers. */ static inline uint32_t leftmost_1bit_idx(uint32_t x) { return x ? log_2_floor(x) : 32; } _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev