From 8cc868015c32dd9e9085f106c03697ea0e808c97 Mon Sep 17 00:00:00 2001 From: Daniele Di Proietto Date: Tue, 27 May 2014 15:20:08 -0700 Subject: [PATCH] lib/flow: call memcmp in miniflow_equal() This commit replace a while loop in miniflow_equal() with a call to memcmp() for performace reasons. Signed-off-by: Daniele Di Proietto Signed-off-by: Ben Pfaff --- lib/flow.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/flow.c b/lib/flow.c index 9c9adc51e..da4f79ba2 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -1748,11 +1748,7 @@ miniflow_equal(const struct miniflow *a, const struct miniflow *b) if (OVS_LIKELY(a_map == b_map)) { int count = miniflow_n_values(a); - while (count--) { - if (*ap++ != *bp++) { - return false; - } - } + return !memcmp(ap, bp, count * sizeof *ap); } else { uint64_t map; -- 2.20.1