[ovs-dev] [PATCH] hmap: Use is_pow2() instead of open-coding it.
Andy Zhou
azhou at nicira.com
Mon Jun 17 23:02:45 UTC 2013
as is, 'is_pow2' already catchs the next line' assert.
But I am not sure why is_pow2 should reject 0.
On Mon, Jun 17, 2013 at 11:35 AM, Ben Pfaff <blp at nicira.com> wrote:
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
> lib/hmap.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/hmap.c b/lib/hmap.c
> index 97c6959..a845269 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,7 +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(is_pow2(new_mask + 1));
> ovs_assert(new_mask != SIZE_MAX);
>
> hmap_init(&tmp);
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20130617/8ed3e985/attachment-0003.html>
More information about the dev
mailing list