summary refs log tree commit diff
path: root/crypto/src/bcpg/BcpgInputStream.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2015-08-14 18:39:29 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2015-08-14 18:39:29 +0700
commit56f23bcdee9c54b6fa3222a759d8df3780e8ac68 (patch)
treee5fca176186ea692606506d78da2d57462abe43c /crypto/src/bcpg/BcpgInputStream.cs
parentAdd locking to lazy factory property (diff)
parentRefactor NextPacketTag() (diff)
downloadBouncyCastle.NET-ed25519-56f23bcdee9c54b6fa3222a759d8df3780e8ac68.tar.xz
Merge branch 'master' of git.bouncycastle.org:bc-csharp
Conflicts:
	crypto/src/asn1/x9/X9ECParametersHolder.cs
Diffstat (limited to 'crypto/src/bcpg/BcpgInputStream.cs')
-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()