diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-08-14 18:03:49 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-08-14 18:03:49 +0700 |
commit | 20534e34ffd976cdbea9c76cb71b3357f3ad6202 (patch) | |
tree | e51d5b505555f23cc6cf14a49e49ac8aba35eb3e /crypto/src/bcpg | |
parent | Optimize (Inv_)Mcol methods in AES engines (diff) | |
download | BouncyCastle.NET-ed25519-20534e34ffd976cdbea9c76cb71b3357f3ad6202.tar.xz |
Refactor NextPacketTag()
Diffstat (limited to 'crypto/src/bcpg')
-rw-r--r-- | crypto/src/bcpg/BcpgInputStream.cs | 18 |
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() |