Skip to content

Commit a09b4d3

Browse files
committed
Review changes, ManickaP dotnet#1
- fix shift count computation - change acc size to 16 bits and append to it by byte
1 parent a995dd3 commit a09b4d3

33 files changed

+39
-42
lines changed

src/libraries/Common/src/System/Net/Http/aspnetcore/Http2/Hpack/Huffman.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,21 +422,18 @@ public static int Decode(ReadOnlySpan<byte> src, ref byte[] dstArray)
422422
int lookupTableIndex = 0;
423423
int lookupIndex;
424424

425-
ulong acc = 0;
425+
ushort acc = 0;
426426
int bitsInAcc = 0;
427427

428428

429429
int i = 0;
430430
int j = 0;
431431
while (i < src.Length)
432432
{
433-
// Load bits into accumulator.
434-
do
435-
{
436-
acc <<= 8;
437-
acc |= src[i++];
438-
bitsInAcc += 8;
439-
} while (i < src.Length && bitsInAcc + 8 <= 64);
433+
// Load next 8 bits into accumulator.
434+
acc <<= 8;
435+
acc |= src[i++];
436+
bitsInAcc += 8;
440437

441438
// Decode bits in accumulator.
442439
do
@@ -492,7 +489,7 @@ public static int Decode(ReadOnlySpan<byte> src, ref byte[] dstArray)
492489
if (lookupTableIndex == 0)
493490
{
494491
// Check if all remaining bits are ones.
495-
uint ones = uint.MaxValue >> (64 - bitsInAcc);
492+
uint ones = uint.MaxValue >> (32 - bitsInAcc);
496493
if ((acc & ones) == ones)
497494
{
498495
// Is it a EOS. See: http://httpwg.org/specs/rfc7541.html#rfc.section.5.2

src/libraries/Common/src/System/Security/Cryptography/Asn1/AlgorithmIdentifierAsn.xml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
#pragma warning disable SA1028 // ignore whitespace warnings for generated code

src/libraries/Common/src/System/Security/Cryptography/Asn1/AttributeAsn.xml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
#pragma warning disable SA1028 // ignore whitespace warnings for generated code

src/libraries/Common/src/System/Security/Cryptography/Asn1/CurveAsn.xml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
#pragma warning disable SA1028 // ignore whitespace warnings for generated code

src/libraries/Common/src/System/Security/Cryptography/Asn1/DigestInfoAsn.xml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
#pragma warning disable SA1028 // ignore whitespace warnings for generated code

src/libraries/Common/src/System/Security/Cryptography/Asn1/DirectoryStringAsn.xml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
#pragma warning disable SA1028 // ignore whitespace warnings for generated code

src/libraries/Common/src/System/Security/Cryptography/Asn1/DssParms.xml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
#pragma warning disable SA1028 // ignore whitespace warnings for generated code

src/libraries/Common/src/System/Security/Cryptography/Asn1/ECDomainParameters.xml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
#pragma warning disable SA1028 // ignore whitespace warnings for generated code

src/libraries/Common/src/System/Security/Cryptography/Asn1/ECPrivateKey.xml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
#pragma warning disable SA1028 // ignore whitespace warnings for generated code

src/libraries/Common/src/System/Security/Cryptography/Asn1/EdiPartyNameAsn.xml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
#pragma warning disable SA1028 // ignore whitespace warnings for generated code

0 commit comments

Comments
 (0)