Skip to content

Commit 8212333

Browse files
committed
move utils to Shared\Encoding
1 parent 51dec55 commit 8212333

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<Compile Include="$(SharedSourceRoot)TrimmingAttributes.cs" LinkBase="Shared" />
2222
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
2323
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
24+
<Compile Include="$(SharedSourceRoot)Encoding\Int7BitEncodingUtils.cs" LinkBase="Shared" />
2425
</ItemGroup>
2526

2627
<ItemGroup>
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
using System.Collections.Generic;
66
using System.Text;
77
using Microsoft.AspNetCore.DataProtection.Internal;
8+
using Microsoft.AspNetCore.Shared;
89

910
namespace Microsoft.AspNetCore.DataProtection.Tests.Internal;
1011

11-
public class Int7BitEncodingUtils
12+
public class Int7BitEncodingUtilsTests
1213
{
1314
[Theory]
1415
[InlineData(0, 1)]
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
using System.Text;
88
using System.Threading.Tasks;
99

10-
namespace Microsoft.AspNetCore.DataProtection.Internal;
10+
namespace Microsoft.AspNetCore.Shared;
11+
1112
internal static class Int7BitEncodingUtils
1213
{
1314
public static int Measure7BitEncodedUIntLength(this int value)
@@ -18,12 +19,12 @@ public static int Measure7BitEncodedUIntLength(this uint value)
1819
#if NET10_0_OR_GREATER
1920
return ((31 - System.Numerics.BitOperations.LeadingZeroCount(value | 1)) / 7) + 1;
2021
#else
21-
int count = 1;
22-
while ((value >>= 7) != 0)
23-
{
24-
count++;
25-
}
26-
return count;
22+
int count = 1;
23+
while ((value >>= 7) != 0)
24+
{
25+
count++;
26+
}
27+
return count;
2728
#endif
2829
}
2930

0 commit comments

Comments
 (0)