mhash_add__() is expensive and should be only called with valid input. This patch will validate the input before invoking the mhash_add__ and there by saving some cpu cycles.
Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodire...@intel.com> Signed-off-by: Antonio Fischetti <antonio.fische...@intel.com> --- lib/hash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hash.h b/lib/hash.h index 114a419..9bfebdb 100644 --- a/lib/hash.h +++ b/lib/hash.h @@ -70,7 +70,7 @@ static inline uint32_t mhash_add__(uint32_t hash, uint32_t data) static inline uint32_t mhash_add(uint32_t hash, uint32_t data) { - hash = mhash_add__(hash, data); + hash = data ? mhash_add__(hash, data): hash; hash = hash_rot(hash, 13); return hash * 5 + 0xe6546b64; } -- 2.4.11 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev