Skip to content

Commit 68eb15a

Browse files
committed
Update HashTable verify results
1 parent f08dd04 commit 68eb15a

File tree

37 files changed

+2425
-3
lines changed

37 files changed

+2425
-3
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// <auto-generated />
2+
// This file is auto-generated. Do not edit manually.
3+
// Structure: HashTable
4+
#nullable enable
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
internal static class HashTableStructure_Byte_3
10+
{
11+
private static readonly sbyte[] _buckets = new sbyte[] {
12+
3, 2, 0
13+
};
14+
15+
private static readonly E[] _entries = {
16+
new E(-1, byte.MinValue), new E(-1, 1), new E(0, byte.MaxValue)
17+
};
18+
19+
20+
public static bool Contains(byte key)
21+
{
22+
if (key < byte.MinValue || key > byte.MaxValue)
23+
return false;
24+
25+
ulong hash = Hash(key);
26+
uint index = (uint)(hash % 3);
27+
sbyte i = (sbyte)(_buckets[index] - 1);
28+
29+
while (i >= 0)
30+
{
31+
ref E entry = ref _entries[i];
32+
33+
if (key == entry.Key)
34+
return true;
35+
36+
i = entry.Next;
37+
}
38+
39+
return false;
40+
}
41+
42+
43+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
44+
private static ulong Hash(byte value)
45+
{
46+
return (ulong)value;
47+
}
48+
49+
[StructLayout(LayoutKind.Auto)]
50+
private readonly struct E
51+
{
52+
53+
internal readonly sbyte Next;
54+
internal readonly byte Key;
55+
56+
57+
internal E(sbyte next, byte key)
58+
{
59+
60+
Next = next;
61+
Key = key;
62+
63+
}
64+
}
65+
66+
67+
public const uint ItemCount = 3;
68+
public const byte MinKey = byte.MinValue;
69+
public const byte MaxKey = byte.MaxValue;
70+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// <auto-generated />
2+
// This file is auto-generated. Do not edit manually.
3+
// Structure: HashTable
4+
#nullable enable
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
internal static class HashTableStructure_Char_3
10+
{
11+
private static readonly sbyte[] _buckets = new sbyte[] {
12+
1, 3, 0
13+
};
14+
15+
private static readonly E[] _entries = {
16+
new E(-1, char.MinValue), new E(-1, 'a'), new E(1, '')
17+
};
18+
19+
20+
public static bool Contains(char key)
21+
{
22+
if (key < char.MinValue || key > '')
23+
return false;
24+
25+
ulong hash = Hash(key);
26+
uint index = (uint)(hash % 3);
27+
sbyte i = (sbyte)(_buckets[index] - 1);
28+
29+
while (i >= 0)
30+
{
31+
ref E entry = ref _entries[i];
32+
33+
if (key == entry.Key)
34+
return true;
35+
36+
i = entry.Next;
37+
}
38+
39+
return false;
40+
}
41+
42+
43+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
44+
private static ulong Hash(char value)
45+
{
46+
return (ulong)value;
47+
}
48+
49+
[StructLayout(LayoutKind.Auto)]
50+
private readonly struct E
51+
{
52+
53+
internal readonly sbyte Next;
54+
internal readonly char Key;
55+
56+
57+
internal E(sbyte next, char key)
58+
{
59+
60+
Next = next;
61+
Key = key;
62+
63+
}
64+
}
65+
66+
67+
public const uint ItemCount = 3;
68+
public const char MinKey = char.MinValue;
69+
public const char MaxKey = '';
70+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// <auto-generated />
2+
// This file is auto-generated. Do not edit manually.
3+
// Structure: HashTable
4+
#nullable enable
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
internal static class HashTableStructure_Double_4
10+
{
11+
private static readonly sbyte[] _buckets = new sbyte[] {
12+
3, 0, 0, 4
13+
};
14+
15+
private static readonly E[] _entries = {
16+
new E(18442240474082181119, -1, double.MinValue), new E(0, -1, 0.0), new E(4607182418800017408, 1, 1.0), new E(9218868437227405311, 0, double.MaxValue)
17+
};
18+
19+
20+
public static bool Contains(double key)
21+
{
22+
if (key < double.MinValue || key > double.MaxValue)
23+
return false;
24+
25+
ulong hash = Hash(key);
26+
uint index = (uint)(hash & 3);
27+
sbyte i = (sbyte)(_buckets[index] - 1);
28+
29+
while (i >= 0)
30+
{
31+
ref E entry = ref _entries[i];
32+
33+
if (entry.HashCode == hash && key == entry.Key)
34+
return true;
35+
36+
i = entry.Next;
37+
}
38+
39+
return false;
40+
}
41+
42+
43+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
44+
private static ulong Hash(double value)
45+
{
46+
ulong bits = Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<double, byte>(ref value));
47+
48+
if (((bits - 1) & ~(0x8000_0000_0000_0000)) >= 0x7FF0_0000_0000_0000)
49+
bits &= 0x7FF0_0000_0000_0000;
50+
51+
return bits;
52+
}
53+
54+
[StructLayout(LayoutKind.Auto)]
55+
private readonly struct E
56+
{
57+
internal readonly ulong HashCode;
58+
internal readonly sbyte Next;
59+
internal readonly double Key;
60+
61+
62+
internal E(ulong hashCode, sbyte next, double key)
63+
{
64+
HashCode = hashCode;
65+
Next = next;
66+
Key = key;
67+
68+
}
69+
}
70+
71+
72+
public const uint ItemCount = 4;
73+
public const double MinKey = double.MinValue;
74+
public const double MaxKey = double.MaxValue;
75+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// <auto-generated />
2+
// This file is auto-generated. Do not edit manually.
3+
// Structure: HashTable
4+
#nullable enable
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
internal static class HashTableStructure_Double_5_HashZeroOrNaN
10+
{
11+
private static readonly sbyte[] _buckets = new sbyte[] {
12+
4, 0, 3, 1, 5
13+
};
14+
15+
private static readonly E[] _entries = {
16+
new E(4607182418800017408, -1, 1.0), new E(4611686018427387904, -1, 2.0), new E(4613937818241073152, -1, 3.0), new E(4616189618054758400, -1, 4.0), new E(4617315517961601024, 1, 5.0)
17+
};
18+
19+
20+
public static bool Contains(double key)
21+
{
22+
if (key < 1.0 || key > 5.0)
23+
return false;
24+
25+
ulong hash = Hash(key);
26+
uint index = (uint)(hash % 5);
27+
sbyte i = (sbyte)(_buckets[index] - 1);
28+
29+
while (i >= 0)
30+
{
31+
ref E entry = ref _entries[i];
32+
33+
if (entry.HashCode == hash && key == entry.Key)
34+
return true;
35+
36+
i = entry.Next;
37+
}
38+
39+
return false;
40+
}
41+
42+
43+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
44+
private static ulong Hash(double value)
45+
{
46+
return Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<double, byte>(ref value));
47+
}
48+
49+
[StructLayout(LayoutKind.Auto)]
50+
private readonly struct E
51+
{
52+
internal readonly ulong HashCode;
53+
internal readonly sbyte Next;
54+
internal readonly double Key;
55+
56+
57+
internal E(ulong hashCode, sbyte next, double key)
58+
{
59+
HashCode = hashCode;
60+
Next = next;
61+
Key = key;
62+
63+
}
64+
}
65+
66+
67+
public const uint ItemCount = 5;
68+
public const double MinKey = 1.0;
69+
public const double MaxKey = 5.0;
70+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// <auto-generated />
2+
// This file is auto-generated. Do not edit manually.
3+
// Structure: HashTable
4+
#nullable enable
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
internal static class HashTableStructure_Int16_5
10+
{
11+
private static readonly sbyte[] _buckets = new sbyte[] {
12+
3, 4, 5, 1, 0
13+
};
14+
15+
private static readonly E[] _entries = {
16+
new E(-1, short.MinValue), new E(-1, -1), new E(1, 0), new E(-1, 1), new E(-1, short.MaxValue)
17+
};
18+
19+
20+
public static bool Contains(short key)
21+
{
22+
if (key < short.MinValue || key > short.MaxValue)
23+
return false;
24+
25+
ulong hash = Hash(key);
26+
uint index = (uint)(hash % 5);
27+
sbyte i = (sbyte)(_buckets[index] - 1);
28+
29+
while (i >= 0)
30+
{
31+
ref E entry = ref _entries[i];
32+
33+
if (key == entry.Key)
34+
return true;
35+
36+
i = entry.Next;
37+
}
38+
39+
return false;
40+
}
41+
42+
43+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
44+
private static ulong Hash(short value)
45+
{
46+
return (ulong)value;
47+
}
48+
49+
[StructLayout(LayoutKind.Auto)]
50+
private readonly struct E
51+
{
52+
53+
internal readonly sbyte Next;
54+
internal readonly short Key;
55+
56+
57+
internal E(sbyte next, short key)
58+
{
59+
60+
Next = next;
61+
Key = key;
62+
63+
}
64+
}
65+
66+
67+
public const uint ItemCount = 5;
68+
public const short MinKey = short.MinValue;
69+
public const short MaxKey = short.MaxValue;
70+
}

0 commit comments

Comments
 (0)