summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2015-08-14 18:03:49 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2015-08-14 18:03:49 +0700
commit20534e34ffd976cdbea9c76cb71b3357f3ad6202 (patch)
treee51d5b505555f23cc6cf14a49e49ac8aba35eb3e
parentOptimize (Inv_)Mcol methods in AES engines (diff)
downloadBouncyCastle.NET-ed25519-20534e34ffd976cdbea9c76cb71b3357f3ad6202.tar.xz
Refactor NextPacketTag()
-rw-r--r--crypto/src/bcpg/BcpgInputStream.cs18
1 files changed, 7 insertions, 11 deletions
diff --git a/crypto/src/bcpg/BcpgInputStream.cs b/crypto/src/bcpg/BcpgInputStream.cs
index 3c69fbdf5..2e08cd090 100644
--- a/crypto/src/bcpg/BcpgInputStream.cs
+++ b/crypto/src/bcpg/BcpgInputStream.cs
@@ -105,19 +105,15 @@ namespace Org.BouncyCastle.Bcpg
                 next = true;
             }
 
-            if (nextB >= 0)
+            if (nextB < 0)
+                return (PacketTag)nextB;
+
+            int maskB = nextB & 0x3f;
+            if ((nextB & 0x40) == 0)    // old
             {
-                if ((nextB & 0x40) != 0)    // new
-                {
-                    return (PacketTag)(nextB & 0x3f);
-                }
-                else    // old
-                {
-                    return (PacketTag)((nextB & 0x3f) >> 2);
-                }
+                maskB >>= 2;
             }
-
-            return (PacketTag) nextB;
+            return (PacketTag)maskB;
         }
 
         public Packet ReadPacket()