-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathInflaterHuffmanTreeTest.cs
More file actions
51 lines (43 loc) · 1.09 KB
/
InflaterHuffmanTreeTest.cs
File metadata and controls
51 lines (43 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using NUnit.Framework;
namespace ICSharpCode.SharpZipLib.Tests.Zip
{
public class InflaterHuffmanTreeTest
{
/// <summary>
/// Generates code based on optimization described in https://github.com/dotnet/csharplang/issues/5295#issue-1028421234
/// </summary>
[Test]
[Explicit]
public void GenerateTrees()
{
// generates the byte arrays needed by InflaterHuffmanTree
var defLitLenTreeBytes = new byte[288];
int i = 0;
while (i < 144)
{
defLitLenTreeBytes[i++] = 8;
}
while (i < 256)
{
defLitLenTreeBytes[i++] = 9;
}
while (i < 280)
{
defLitLenTreeBytes[i++] = 7;
}
while (i < 288)
{
defLitLenTreeBytes[i++] = 8;
}
Console.WriteLine($"private static ReadOnlySpan<byte> defLitLenTreeBytes => new byte[] {{ { string.Join(", ", defLitLenTreeBytes) } }};");
var defDistTreeBytes = new byte[32];
i = 0;
while (i < 32)
{
defDistTreeBytes[i++] = 5;
}
Console.WriteLine($"private static ReadOnlySpan<byte> defDistTreeBytes => new byte[] {{ { string.Join(", ", defDistTreeBytes) } }};");
}
}
}