From: Ben Pfaff Date: Tue, 18 Jun 2013 16:55:02 +0000 (-0700) Subject: hmap: Use is_pow2() instead of open-coding it. X-Git-Tag: sliver-openvswitch-1.10.90-3~6^2~98 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=34a78b1869c69fa6bf50e2b77ee7969f00509794;p=sliver-openvswitch.git hmap: Use is_pow2() instead of open-coding it. Also, SIZE_MAX + 1 is 0, which is not a power of 2, so the following assert is redundant and this commit removes it. Signed-off-by: Ben Pfaff --- diff --git a/lib/hmap.c b/lib/hmap.c index 97c6959de..f15e72cb9 100644 --- a/lib/hmap.c +++ b/lib/hmap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2012 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,8 +90,7 @@ resize(struct hmap *hmap, size_t new_mask) struct hmap tmp; size_t i; - ovs_assert(!(new_mask & (new_mask + 1))); - ovs_assert(new_mask != SIZE_MAX); + ovs_assert(is_pow2(new_mask + 1)); hmap_init(&tmp); if (new_mask) {