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 <jrajaha...@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

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to