[ovs-dev] [PATCH] Use is_pow2() function, where possible, instead of IS_POW2 macro.

Ben Pfaff blp at nicira.com
Thu Nov 1 00:04:41 UTC 2012


The IS_POW2 macro is meant for use in contexts where a function call is not
allowed.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/util.c            |    2 +-
 utilities/ovs-ofctl.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/util.c b/lib/util.c
index c90d556..4869528 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -787,7 +787,7 @@ log_2_floor(uint32_t n)
 int
 log_2_ceil(uint32_t n)
 {
-    return log_2_floor(n) + !IS_POW2(n);
+    return log_2_floor(n) + !is_pow2(n);
 }
 
 /* Returns the number of trailing 0-bits in 'n'.  Undefined if 'n' == 0. */
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index a67a554..573a217 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -2128,7 +2128,7 @@ ofctl_parse_flows__(struct ofputil_flow_mod *fms, size_t n_fms)
             break;
         }
     }
-    assert(IS_POW2(protocol));
+    assert(is_pow2(protocol));
 
     printf("chosen protocol: %s\n", ofputil_protocol_to_string(protocol));
 
-- 
1.7.2.5



More information about the dev mailing list