[ovs-dev] [PATCH 6/7] lib/flow: Reduce calls to count_1bits().
Jarno Rajahalme
jrajahalme at nicira.com
Wed Oct 1 23:02:36 UTC 2014
Depending on the CPU, count_1bits() may be more or less expensive, so
it is better to avoid unnecessary calls to it. When the map has
consecutive 1-bits, those can be cleared without counting.
Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
---
lib/flow.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/flow.h b/lib/flow.h
index 9bb9a58..a6e75c7 100644
--- a/lib/flow.h
+++ b/lib/flow.h
@@ -507,7 +507,8 @@ mf_get_next_in_map(uint64_t *fmap, uint64_t rm1bit, const uint32_t **fp,
*fmap -= trash;
*fp += count_1bits(trash);
}
- *value = **fp;
+ *fmap -= rm1bit;
+ *value = *(*fp)++;
}
return rm1bit != 0;
}
--
1.7.10.4
More information about the dev
mailing list