[ovs-dev] [non-NORMAL learning 1/3] tag: Use existing macro instead of constant.

Ben Pfaff blp at nicira.com
Wed Aug 4 17:27:35 UTC 2010


N_TAG_BITS is always 32, currently, because tag_type is a typedef
for uint32_t, so this does not fix an actual bug.
---
 lib/tag.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/tag.c b/lib/tag.c
index 955cf30..0430224 100644
--- a/lib/tag.c
+++ b/lib/tag.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -49,7 +49,7 @@ tag_type
 tag_create_deterministic(uint32_t seed)
 {
     int x = seed & (N_TAG_BITS - 1);
-    int y = (seed >> LOG2_N_TAG_BITS) % 31;
+    int y = (seed >> LOG2_N_TAG_BITS) % (N_TAG_BITS - 1);
     y += y >= x;
     return (1u << x) | (1u << y);
 }
-- 
1.7.1





More information about the dev mailing list