It doesn't make sense for either of these parameters to be
negative. This seems more intuitive.
---
 lib/nx-match.c |    7 ++++---
 lib/nx-match.h |    9 +++++----
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/lib/nx-match.c b/lib/nx-match.c
index ecc284e..cc29c6c 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -1139,15 +1139,16 @@ nxm_parse_reg_load(struct nx_action_reg_load *load, 
const char *s)
 /* nxm_format_reg_move(), nxm_format_reg_load(). */
 
 void
-nxm_format_field_bits(struct ds *s, uint32_t header, int ofs, int n_bits)
+nxm_format_field_bits(struct ds *s, uint32_t header, unsigned int ofs,
+                      unsigned int n_bits)
 {
     format_nxm_field_name(s, header);
     if (ofs == 0 && n_bits == nxm_field_bits(header)) {
         ds_put_cstr(s, "[]");
     } else if (n_bits == 1) {
-        ds_put_format(s, "[%d]", ofs);
+        ds_put_format(s, "[%u]", ofs);
     } else {
-        ds_put_format(s, "[%d..%d]", ofs, ofs + n_bits - 1);
+        ds_put_format(s, "[%u..%u]", ofs, ofs + n_bits - 1);
     }
 }
 
diff --git a/lib/nx-match.h b/lib/nx-match.h
index 5365cca..28692c7 100644
--- a/lib/nx-match.h
+++ b/lib/nx-match.h
@@ -62,24 +62,25 @@ int nxm_field_bits(uint32_t header);
 
 const char *nxm_parse_field_bits(const char *s,
                                  uint32_t *headerp, int *ofsp, int *n_bitsp);
-void nxm_format_field_bits(struct ds *, uint32_t header, int ofs, int n_bits);
+void nxm_format_field_bits(struct ds *, uint32_t header, unsigned int ofs,
+                           unsigned int n_bits);
 
 /* Dealing with the 'ofs_nbits' members of struct nx_action_reg_load and struct
  * nx_action_multipath. */
 
 static inline ovs_be16
-nxm_encode_ofs_nbits(int ofs, int n_bits)
+nxm_encode_ofs_nbits(unsigned int ofs, unsigned int n_bits)
 {
     return htons((ofs << 6) | (n_bits - 1));
 }
 
-static inline int
+static inline unsigned int
 nxm_decode_ofs(ovs_be16 ofs_nbits)
 {
     return ntohs(ofs_nbits) >> 6;
 }
 
-static inline int
+static inline unsigned int
 nxm_decode_n_bits(ovs_be16 ofs_nbits)
 {
     return (ntohs(ofs_nbits) & 0x3f) + 1;
-- 
1.7.6

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to