Message ID | 1442531068-41423-4-git-send-email-joestringer@nicira.com |
---|---|
State | Awaiting Upstream |
Headers | show |
On Thu, Sep 17, 2015 at 04:04:25PM -0700, Joe Stringer wrote: > From: Daniele Di Proietto <diproiettod@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 <joestringer@nicira.com> > Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
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