Skip to content

Commit 7f2f5e9

Browse files
committed
Add support for StoreHashCode in C#
1 parent 545c7d4 commit 7f2f5e9

13 files changed

+118
-114
lines changed

Src/FastData.Generator.CSharp.Tests/Verify/HashSetChainStructure_Byte_3.verified.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal static class HashSetChainStructure_Byte_3
1313
};
1414

1515
private static readonly E[] _entries = {
16-
new E(0, -1, byte.MinValue), new E(1, -1, 1), new E(255, 0, byte.MaxValue)
16+
new E(-1, byte.MinValue), new E(-1, 1), new E(0, byte.MaxValue)
1717
};
1818

1919

@@ -30,7 +30,7 @@ internal static class HashSetChainStructure_Byte_3
3030
{
3131
ref E entry = ref _entries[i];
3232

33-
if (entry.HashCode == hash && value == entry.Value)
33+
if (value == entry.Value)
3434
return true;
3535

3636
i = entry.Next;
@@ -48,13 +48,13 @@ internal static class HashSetChainStructure_Byte_3
4848
[StructLayout(LayoutKind.Auto)]
4949
private readonly struct E
5050
{
51-
internal readonly ulong HashCode;
51+
5252
internal readonly sbyte Next;
5353
internal readonly byte Value;
5454

55-
internal E(ulong hashCode, sbyte next, byte value)
55+
internal E(sbyte next, byte value)
5656
{
57-
HashCode = hashCode;
57+
5858
Next = next;
5959
Value = value;
6060
}

Src/FastData.Generator.CSharp.Tests/Verify/HashSetChainStructure_Char_3.verified.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal static class HashSetChainStructure_Char_3
1313
};
1414

1515
private static readonly E[] _entries = {
16-
new E(0, -1, char.MinValue), new E(97, -1, 'a'), new E(127, 1, '')
16+
new E(-1, char.MinValue), new E(-1, 'a'), new E(1, '')
1717
};
1818

1919

@@ -30,7 +30,7 @@ internal static class HashSetChainStructure_Char_3
3030
{
3131
ref E entry = ref _entries[i];
3232

33-
if (entry.HashCode == hash && value == entry.Value)
33+
if (value == entry.Value)
3434
return true;
3535

3636
i = entry.Next;
@@ -48,13 +48,13 @@ internal static class HashSetChainStructure_Char_3
4848
[StructLayout(LayoutKind.Auto)]
4949
private readonly struct E
5050
{
51-
internal readonly ulong HashCode;
51+
5252
internal readonly sbyte Next;
5353
internal readonly char Value;
5454

55-
internal E(ulong hashCode, sbyte next, char value)
55+
internal E(sbyte next, char value)
5656
{
57-
HashCode = hashCode;
57+
5858
Next = next;
5959
Value = value;
6060
}

Src/FastData.Generator.CSharp.Tests/Verify/HashSetChainStructure_Int16_5.verified.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal static class HashSetChainStructure_Int16_5
1313
};
1414

1515
private static readonly E[] _entries = {
16-
new E(18446744073709518848, -1, short.MinValue), new E(18446744073709551615, -1, -1), new E(0, 1, 0), new E(1, -1, 1), new E(32767, -1, short.MaxValue)
16+
new E(-1, short.MinValue), new E(-1, -1), new E(1, 0), new E(-1, 1), new E(-1, short.MaxValue)
1717
};
1818

1919

@@ -30,7 +30,7 @@ internal static class HashSetChainStructure_Int16_5
3030
{
3131
ref E entry = ref _entries[i];
3232

33-
if (entry.HashCode == hash && value == entry.Value)
33+
if (value == entry.Value)
3434
return true;
3535

3636
i = entry.Next;
@@ -48,13 +48,13 @@ internal static class HashSetChainStructure_Int16_5
4848
[StructLayout(LayoutKind.Auto)]
4949
private readonly struct E
5050
{
51-
internal readonly ulong HashCode;
51+
5252
internal readonly sbyte Next;
5353
internal readonly short Value;
5454

55-
internal E(ulong hashCode, sbyte next, short value)
55+
internal E(sbyte next, short value)
5656
{
57-
HashCode = hashCode;
57+
5858
Next = next;
5959
Value = value;
6060
}

Src/FastData.Generator.CSharp.Tests/Verify/HashSetChainStructure_Int32_100.verified.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ internal static class HashSetChainStructure_Int32_100
2222
};
2323

2424
private static readonly E[] _entries = {
25-
new E(0, -1, 0), new E(1, -1, 1), new E(2, -1, 2), new E(3, -1, 3), new E(4, -1, 4), new E(5, -1, 5), new E(6, -1, 6), new E(7, -1, 7), new E(8, -1, 8), new E(9, -1, 9),
26-
new E(10, -1, 10), new E(11, -1, 11), new E(12, -1, 12), new E(13, -1, 13), new E(14, -1, 14), new E(15, -1, 15), new E(16, -1, 16), new E(17, -1, 17), new E(18, -1, 18), new E(19, -1, 19),
27-
new E(20, -1, 20), new E(21, -1, 21), new E(22, -1, 22), new E(23, -1, 23), new E(24, -1, 24), new E(25, -1, 25), new E(26, -1, 26), new E(27, -1, 27), new E(28, -1, 28), new E(29, -1, 29),
28-
new E(30, -1, 30), new E(31, -1, 31), new E(32, -1, 32), new E(33, -1, 33), new E(34, -1, 34), new E(35, -1, 35), new E(36, -1, 36), new E(37, -1, 37), new E(38, -1, 38), new E(39, -1, 39),
29-
new E(40, -1, 40), new E(41, -1, 41), new E(42, -1, 42), new E(43, -1, 43), new E(44, -1, 44), new E(45, -1, 45), new E(46, -1, 46), new E(47, -1, 47), new E(48, -1, 48), new E(49, -1, 49),
30-
new E(50, -1, 50), new E(51, -1, 51), new E(52, -1, 52), new E(53, -1, 53), new E(54, -1, 54), new E(55, -1, 55), new E(56, -1, 56), new E(57, -1, 57), new E(58, -1, 58), new E(59, -1, 59),
31-
new E(60, -1, 60), new E(61, -1, 61), new E(62, -1, 62), new E(63, -1, 63), new E(64, -1, 64), new E(65, -1, 65), new E(66, -1, 66), new E(67, -1, 67), new E(68, -1, 68), new E(69, -1, 69),
32-
new E(70, -1, 70), new E(71, -1, 71), new E(72, -1, 72), new E(73, -1, 73), new E(74, -1, 74), new E(75, -1, 75), new E(76, -1, 76), new E(77, -1, 77), new E(78, -1, 78), new E(79, -1, 79),
33-
new E(80, -1, 80), new E(81, -1, 81), new E(82, -1, 82), new E(83, -1, 83), new E(84, -1, 84), new E(85, -1, 85), new E(86, -1, 86), new E(87, -1, 87), new E(88, -1, 88), new E(89, -1, 89),
34-
new E(90, -1, 90), new E(91, -1, 91), new E(92, -1, 92), new E(93, -1, 93), new E(94, -1, 94), new E(95, -1, 95), new E(96, -1, 96), new E(97, -1, 97), new E(98, -1, 98), new E(99, -1, 99)
25+
new E(-1, 0), new E(-1, 1), new E(-1, 2), new E(-1, 3), new E(-1, 4), new E(-1, 5), new E(-1, 6), new E(-1, 7), new E(-1, 8), new E(-1, 9),
26+
new E(-1, 10), new E(-1, 11), new E(-1, 12), new E(-1, 13), new E(-1, 14), new E(-1, 15), new E(-1, 16), new E(-1, 17), new E(-1, 18), new E(-1, 19),
27+
new E(-1, 20), new E(-1, 21), new E(-1, 22), new E(-1, 23), new E(-1, 24), new E(-1, 25), new E(-1, 26), new E(-1, 27), new E(-1, 28), new E(-1, 29),
28+
new E(-1, 30), new E(-1, 31), new E(-1, 32), new E(-1, 33), new E(-1, 34), new E(-1, 35), new E(-1, 36), new E(-1, 37), new E(-1, 38), new E(-1, 39),
29+
new E(-1, 40), new E(-1, 41), new E(-1, 42), new E(-1, 43), new E(-1, 44), new E(-1, 45), new E(-1, 46), new E(-1, 47), new E(-1, 48), new E(-1, 49),
30+
new E(-1, 50), new E(-1, 51), new E(-1, 52), new E(-1, 53), new E(-1, 54), new E(-1, 55), new E(-1, 56), new E(-1, 57), new E(-1, 58), new E(-1, 59),
31+
new E(-1, 60), new E(-1, 61), new E(-1, 62), new E(-1, 63), new E(-1, 64), new E(-1, 65), new E(-1, 66), new E(-1, 67), new E(-1, 68), new E(-1, 69),
32+
new E(-1, 70), new E(-1, 71), new E(-1, 72), new E(-1, 73), new E(-1, 74), new E(-1, 75), new E(-1, 76), new E(-1, 77), new E(-1, 78), new E(-1, 79),
33+
new E(-1, 80), new E(-1, 81), new E(-1, 82), new E(-1, 83), new E(-1, 84), new E(-1, 85), new E(-1, 86), new E(-1, 87), new E(-1, 88), new E(-1, 89),
34+
new E(-1, 90), new E(-1, 91), new E(-1, 92), new E(-1, 93), new E(-1, 94), new E(-1, 95), new E(-1, 96), new E(-1, 97), new E(-1, 98), new E(-1, 99)
3535
};
3636

3737

@@ -48,7 +48,7 @@ internal static class HashSetChainStructure_Int32_100
4848
{
4949
ref E entry = ref _entries[i];
5050

51-
if (entry.HashCode == hash && value == entry.Value)
51+
if (value == entry.Value)
5252
return true;
5353

5454
i = entry.Next;
@@ -66,13 +66,13 @@ internal static class HashSetChainStructure_Int32_100
6666
[StructLayout(LayoutKind.Auto)]
6767
private readonly struct E
6868
{
69-
internal readonly ulong HashCode;
69+
7070
internal readonly sbyte Next;
7171
internal readonly int Value;
7272

73-
internal E(ulong hashCode, sbyte next, int value)
73+
internal E(sbyte next, int value)
7474
{
75-
HashCode = hashCode;
75+
7676
Next = next;
7777
Value = value;
7878
}

Src/FastData.Generator.CSharp.Tests/Verify/HashSetChainStructure_Int32_5.verified.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal static class HashSetChainStructure_Int32_5
1313
};
1414

1515
private static readonly E[] _entries = {
16-
new E(18446744071562067968, -1, int.MinValue), new E(18446744073709551615, -1, -1), new E(0, 1, 0), new E(1, -1, 1), new E(2147483647, -1, int.MaxValue)
16+
new E(-1, int.MinValue), new E(-1, -1), new E(1, 0), new E(-1, 1), new E(-1, int.MaxValue)
1717
};
1818

1919

@@ -30,7 +30,7 @@ internal static class HashSetChainStructure_Int32_5
3030
{
3131
ref E entry = ref _entries[i];
3232

33-
if (entry.HashCode == hash && value == entry.Value)
33+
if (value == entry.Value)
3434
return true;
3535

3636
i = entry.Next;
@@ -48,13 +48,13 @@ internal static class HashSetChainStructure_Int32_5
4848
[StructLayout(LayoutKind.Auto)]
4949
private readonly struct E
5050
{
51-
internal readonly ulong HashCode;
51+
5252
internal readonly sbyte Next;
5353
internal readonly int Value;
5454

55-
internal E(ulong hashCode, sbyte next, int value)
55+
internal E(sbyte next, int value)
5656
{
57-
HashCode = hashCode;
57+
5858
Next = next;
5959
Value = value;
6060
}

Src/FastData.Generator.CSharp.Tests/Verify/HashSetChainStructure_Int64_5.verified.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal static class HashSetChainStructure_Int64_5
1313
};
1414

1515
private static readonly E[] _entries = {
16-
new E(9223372036854775808, -1, long.MinValue), new E(18446744073709551611, -1, -5l), new E(0, -1, 0l), new E(1, 1, 1l), new E(9223372036854775806, 3, 9223372036854775806l)
16+
new E(-1, long.MinValue), new E(-1, -5l), new E(-1, 0l), new E(1, 1l), new E(3, 9223372036854775806l)
1717
};
1818

1919

@@ -30,7 +30,7 @@ internal static class HashSetChainStructure_Int64_5
3030
{
3131
ref E entry = ref _entries[i];
3232

33-
if (entry.HashCode == hash && value == entry.Value)
33+
if (value == entry.Value)
3434
return true;
3535

3636
i = entry.Next;
@@ -48,13 +48,13 @@ internal static class HashSetChainStructure_Int64_5
4848
[StructLayout(LayoutKind.Auto)]
4949
private readonly struct E
5050
{
51-
internal readonly ulong HashCode;
51+
5252
internal readonly sbyte Next;
5353
internal readonly long Value;
5454

55-
internal E(ulong hashCode, sbyte next, long value)
55+
internal E(sbyte next, long value)
5656
{
57-
HashCode = hashCode;
57+
5858
Next = next;
5959
Value = value;
6060
}

Src/FastData.Generator.CSharp.Tests/Verify/HashSetChainStructure_SByte_5.verified.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal static class HashSetChainStructure_SByte_5
1313
};
1414

1515
private static readonly E[] _entries = {
16-
new E(18446744073709551488, -1, sbyte.MinValue), new E(18446744073709551615, -1, -1), new E(0, 1, 0), new E(1, -1, 1), new E(127, -1, sbyte.MaxValue)
16+
new E(-1, sbyte.MinValue), new E(-1, -1), new E(1, 0), new E(-1, 1), new E(-1, sbyte.MaxValue)
1717
};
1818

1919

@@ -30,7 +30,7 @@ internal static class HashSetChainStructure_SByte_5
3030
{
3131
ref E entry = ref _entries[i];
3232

33-
if (entry.HashCode == hash && value == entry.Value)
33+
if (value == entry.Value)
3434
return true;
3535

3636
i = entry.Next;
@@ -48,13 +48,13 @@ internal static class HashSetChainStructure_SByte_5
4848
[StructLayout(LayoutKind.Auto)]
4949
private readonly struct E
5050
{
51-
internal readonly ulong HashCode;
51+
5252
internal readonly sbyte Next;
5353
internal readonly sbyte Value;
5454

55-
internal E(ulong hashCode, sbyte next, sbyte value)
55+
internal E(sbyte next, sbyte value)
5656
{
57-
HashCode = hashCode;
57+
5858
Next = next;
5959
Value = value;
6060
}

Src/FastData.Generator.CSharp.Tests/Verify/HashSetChainStructure_UInt16_4.verified.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal static class HashSetChainStructure_UInt16_4
1313
};
1414

1515
private static readonly E[] _entries = {
16-
new E(0, -1, ushort.MinValue), new E(1, -1, 1), new E(2, -1, 2), new E(65535, -1, ushort.MaxValue)
16+
new E(-1, ushort.MinValue), new E(-1, 1), new E(-1, 2), new E(-1, ushort.MaxValue)
1717
};
1818

1919

@@ -30,7 +30,7 @@ internal static class HashSetChainStructure_UInt16_4
3030
{
3131
ref E entry = ref _entries[i];
3232

33-
if (entry.HashCode == hash && value == entry.Value)
33+
if (value == entry.Value)
3434
return true;
3535

3636
i = entry.Next;
@@ -48,13 +48,13 @@ internal static class HashSetChainStructure_UInt16_4
4848
[StructLayout(LayoutKind.Auto)]
4949
private readonly struct E
5050
{
51-
internal readonly ulong HashCode;
51+
5252
internal readonly sbyte Next;
5353
internal readonly ushort Value;
5454

55-
internal E(ulong hashCode, sbyte next, ushort value)
55+
internal E(sbyte next, ushort value)
5656
{
57-
HashCode = hashCode;
57+
5858
Next = next;
5959
Value = value;
6060
}

Src/FastData.Generator.CSharp.Tests/Verify/HashSetChainStructure_UInt32_4.verified.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal static class HashSetChainStructure_UInt32_4
1313
};
1414

1515
private static readonly E[] _entries = {
16-
new E(0, -1, uint.MinValue), new E(1, -1, 1u), new E(2, -1, 2u), new E(4294967295, -1, uint.MaxValue)
16+
new E(-1, uint.MinValue), new E(-1, 1u), new E(-1, 2u), new E(-1, uint.MaxValue)
1717
};
1818

1919

@@ -30,7 +30,7 @@ internal static class HashSetChainStructure_UInt32_4
3030
{
3131
ref E entry = ref _entries[i];
3232

33-
if (entry.HashCode == hash && value == entry.Value)
33+
if (value == entry.Value)
3434
return true;
3535

3636
i = entry.Next;
@@ -48,13 +48,13 @@ internal static class HashSetChainStructure_UInt32_4
4848
[StructLayout(LayoutKind.Auto)]
4949
private readonly struct E
5050
{
51-
internal readonly ulong HashCode;
51+
5252
internal readonly sbyte Next;
5353
internal readonly uint Value;
5454

55-
internal E(ulong hashCode, sbyte next, uint value)
55+
internal E(sbyte next, uint value)
5656
{
57-
HashCode = hashCode;
57+
5858
Next = next;
5959
Value = value;
6060
}

Src/FastData.Generator.CSharp.Tests/Verify/HashSetChainStructure_UInt64_4.verified.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal static class HashSetChainStructure_UInt64_4
1313
};
1414

1515
private static readonly E[] _entries = {
16-
new E(0, -1, ulong.MinValue), new E(1, -1, 1ul), new E(2, -1, 2ul), new E(18446744073709551605, 1, 18446744073709551605ul)
16+
new E(-1, ulong.MinValue), new E(-1, 1ul), new E(-1, 2ul), new E(1, 18446744073709551605ul)
1717
};
1818

1919

@@ -30,7 +30,7 @@ internal static class HashSetChainStructure_UInt64_4
3030
{
3131
ref E entry = ref _entries[i];
3232

33-
if (entry.HashCode == hash && value == entry.Value)
33+
if (value == entry.Value)
3434
return true;
3535

3636
i = entry.Next;
@@ -48,13 +48,13 @@ internal static class HashSetChainStructure_UInt64_4
4848
[StructLayout(LayoutKind.Auto)]
4949
private readonly struct E
5050
{
51-
internal readonly ulong HashCode;
51+
5252
internal readonly sbyte Next;
5353
internal readonly ulong Value;
5454

55-
internal E(ulong hashCode, sbyte next, ulong value)
55+
internal E(sbyte next, ulong value)
5656
{
57-
HashCode = hashCode;
57+
5858
Next = next;
5959
Value = value;
6060
}

0 commit comments

Comments
 (0)