mirror of
https://github.com/openvswitch/ovs
synced 2025-09-04 00:05:15 +00:00
lib/bitmap: Faster bitmap functions.
Replace bitwise loops with a single operation, inline all bitmap functions. Inlining allows the compiler to remove unnecessary code due to some parameters being compile-time constants. Before: $ tests/ovstest test-bitmap benchmark 1000000 bitmap equal: 341 ms bitmap scan: 8089 ms After: $ tests/ovstest test-bitmap benchmark 1000000 bitmap equal: 152 ms bitmap scan: 146 ms Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Co-authored-by: Kmindg <kmindg@gmail.com> Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -512,7 +512,7 @@ zero_rightmost_1bit(uintmax_t x)
|
||||
*
|
||||
* Unlike the other functions for rightmost 1-bits, this function only works
|
||||
* with 32-bit integers. */
|
||||
static inline uint32_t
|
||||
static inline int
|
||||
rightmost_1bit_idx(uint32_t x)
|
||||
{
|
||||
return ctz32(x);
|
||||
|
Reference in New Issue
Block a user