From: Daniele Di Proietto <diproiet...@vmware.com> is_all_zeros() is quite slow for u128 initialization because: - It is not inlined - It checks byte by byte
This commit introduces a new function to perform this function, which improves performance in the DPDK packet processing path for upcoming commits that regularly check u128 values. Signed-off-by: Joe Stringer <joestrin...@nicira.com> Acked-by: Jarno Rajahalme <jrajaha...@nicira.com> --- lib/util.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/util.h b/lib/util.h index 7080a0c..eebc6e9 100644 --- a/lib/util.h +++ b/lib/util.h @@ -568,6 +568,13 @@ ovs_u128_equals(const ovs_u128 *a, const ovs_u128 *b) return (a->u64.hi == b->u64.hi) && (a->u64.lo == b->u64.lo); } +/* Returns true if 'val' is 0. */ +static inline bool +ovs_u128_is_zero(const ovs_u128 *val) +{ + return !(val->u64.hi || val->u64.lo); +} + void xsleep(unsigned int seconds); #ifdef _WIN32 -- 2.1.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev