Use 0-shifting operand 80/7680/1
authorRobert Varga <rovarga@cisco.com>
Wed, 4 Jun 2014 12:01:49 +0000 (14:01 +0200)
committerRobert Varga <rovarga@cisco.com>
Wed, 4 Jun 2014 12:02:58 +0000 (14:02 +0200)
Do not use sign-dependent operator. Should not matter, as we follow up
with mask, but this makes the intent obvious.

Change-Id: Ie5c4df5373d19f6abe8b48df5b965ee43bf3e8eb
Signed-off-by: Robert Varga <rovarga@cisco.com>
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ByteBufUtils.java

index 07ad5584894a40813ab1ad945f9f2d170a24750b..59439662c9a6e1886aba84de064acd1bbae9d815 100644 (file)
@@ -248,15 +248,15 @@ public abstract class ByteBufUtils {
 
     private static final void appendHexByte(final StringBuilder sb, final byte b) {
         final int v = UnsignedBytes.toInt(b);
-        sb.append(HEX_CHARS[v >> 4]);
-        sb.append(HEX_CHARS[v & 15]);
+        sb.append(HEX_CHARS[v >>> 4]);
+        sb.append(HEX_CHARS[v &  15]);
     }
 
     private static void appendHexUnsignedShort(final StringBuilder sb, final int val) {
-        sb.append(ByteBufUtils.HEX_CHARS[(val >> 12) & 15]);
-        sb.append(ByteBufUtils.HEX_CHARS[(val >>  8) & 15]);
-        sb.append(ByteBufUtils.HEX_CHARS[(val >>  4) & 15]);
-        sb.append(ByteBufUtils.HEX_CHARS[ val        & 15]);
+        sb.append(ByteBufUtils.HEX_CHARS[(val >>> 12) & 15]);
+        sb.append(ByteBufUtils.HEX_CHARS[(val >>>  8) & 15]);
+        sb.append(ByteBufUtils.HEX_CHARS[(val >>>  4) & 15]);
+        sb.append(ByteBufUtils.HEX_CHARS[ val         & 15]);
     }
 
     /**