Skip to content

Commit 5c9c6a0

Browse files
committed
Add support for StoreHashCode in C++
1 parent 7f2f5e9 commit 5c9c6a0

13 files changed

+129
-118
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ class HashSetChainStructure_Byte_3 final
1010
{
1111
struct e
1212
{
13-
uint64_t hash_code;
13+
1414
int8_t next;
1515
uint8_t value;
1616

17-
e(const uint64_t hash_code, const int8_t next, const uint8_t value)
18-
: hash_code(hash_code), next(next), value(value) {}
17+
e(const int8_t next, const uint8_t value)
18+
: next(next), value(value) {}
1919
};
2020

2121
static constexpr std::array<int8_t, 3> buckets = {
2222
3, 2, 0
2323
};
2424

2525
inline static const std::array<e, 3> entries = {
26-
e(0, -1, 0), e(1, -1, 1), e(255, 0, std::numeric_limits<uint8_t>::max())
26+
e(-1, 0), e(-1, 1), e(0, std::numeric_limits<uint8_t>::max())
2727
};
2828

2929
static constexpr uint64_t get_hash(const uint8_t value) noexcept
@@ -44,9 +44,9 @@ public:
4444

4545
while (i >= 0)
4646
{
47-
const auto& [hash_code, next, value1] = entries[i];
47+
const auto& [next, value1] = entries[i];
4848

49-
if (hash_code == hash && value1 == value)
49+
if (value1 == value)
5050
return true;
5151

5252
i = next;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ class HashSetChainStructure_Char_3 final
1010
{
1111
struct e
1212
{
13-
uint64_t hash_code;
13+
1414
int8_t next;
1515
char value;
1616

17-
e(const uint64_t hash_code, const int8_t next, const char value)
18-
: hash_code(hash_code), next(next), value(value) {}
17+
e(const int8_t next, const char value)
18+
: next(next), value(value) {}
1919
};
2020

2121
static constexpr std::array<int8_t, 3> buckets = {
2222
1, 3, 0
2323
};
2424

2525
inline static const std::array<e, 3> entries = {
26-
e(0, -1, 0), e(97, -1, 97), e(127, 1, 127)
26+
e(-1, 0), e(-1, 97), e(1, 127)
2727
};
2828

2929
static constexpr uint64_t get_hash(const char value) noexcept
@@ -44,9 +44,9 @@ public:
4444

4545
while (i >= 0)
4646
{
47-
const auto& [hash_code, next, value1] = entries[i];
47+
const auto& [next, value1] = entries[i];
4848

49-
if (hash_code == hash && value1 == value)
49+
if (value1 == value)
5050
return true;
5151

5252
i = next;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ class HashSetChainStructure_Int16_5 final
1010
{
1111
struct e
1212
{
13-
uint64_t hash_code;
13+
1414
int8_t next;
1515
int16_t value;
1616

17-
e(const uint64_t hash_code, const int8_t next, const int16_t value)
18-
: hash_code(hash_code), next(next), value(value) {}
17+
e(const int8_t next, const int16_t value)
18+
: next(next), value(value) {}
1919
};
2020

2121
static constexpr std::array<int8_t, 5> buckets = {
2222
3, 4, 5, 1, 0
2323
};
2424

2525
inline static const std::array<e, 5> entries = {
26-
e(18446744073709518848, -1, std::numeric_limits<int16_t>::lowest()), e(18446744073709551615, -1, -1), e(0, 1, 0), e(1, -1, 1), e(32767, -1, std::numeric_limits<int16_t>::max())
26+
e(-1, std::numeric_limits<int16_t>::lowest()), e(-1, -1), e(1, 0), e(-1, 1), e(-1, std::numeric_limits<int16_t>::max())
2727
};
2828

2929
static constexpr uint64_t get_hash(const int16_t value) noexcept
@@ -44,9 +44,9 @@ public:
4444

4545
while (i >= 0)
4646
{
47-
const auto& [hash_code, next, value1] = entries[i];
47+
const auto& [next, value1] = entries[i];
4848

49-
if (hash_code == hash && value1 == value)
49+
if (value1 == value)
5050
return true;
5151

5252
i = next;

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ class HashSetChainStructure_Int32_100 final
1010
{
1111
struct e
1212
{
13-
uint64_t hash_code;
13+
1414
int8_t next;
1515
int32_t value;
1616

17-
e(const uint64_t hash_code, const int8_t next, const int32_t value)
18-
: hash_code(hash_code), next(next), value(value) {}
17+
e(const int8_t next, const int32_t value)
18+
: next(next), value(value) {}
1919
};
2020

2121
static constexpr std::array<int8_t, 100> buckets = {
@@ -32,16 +32,16 @@ class HashSetChainStructure_Int32_100 final
3232
};
3333

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

4747
static constexpr uint64_t get_hash(const int32_t value) noexcept
@@ -62,9 +62,9 @@ public:
6262

6363
while (i >= 0)
6464
{
65-
const auto& [hash_code, next, value1] = entries[i];
65+
const auto& [next, value1] = entries[i];
6666

67-
if (hash_code == hash && value1 == value)
67+
if (value1 == value)
6868
return true;
6969

7070
i = next;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ class HashSetChainStructure_Int32_5 final
1010
{
1111
struct e
1212
{
13-
uint64_t hash_code;
13+
1414
int8_t next;
1515
int32_t value;
1616

17-
e(const uint64_t hash_code, const int8_t next, const int32_t value)
18-
: hash_code(hash_code), next(next), value(value) {}
17+
e(const int8_t next, const int32_t value)
18+
: next(next), value(value) {}
1919
};
2020

2121
static constexpr std::array<int8_t, 5> buckets = {
2222
3, 4, 5, 1, 0
2323
};
2424

2525
inline static const std::array<e, 5> entries = {
26-
e(18446744071562067968, -1, std::numeric_limits<int32_t>::lowest()), e(18446744073709551615, -1, -1), e(0, 1, 0), e(1, -1, 1), e(2147483647, -1, std::numeric_limits<int32_t>::max())
26+
e(-1, std::numeric_limits<int32_t>::lowest()), e(-1, -1), e(1, 0), e(-1, 1), e(-1, std::numeric_limits<int32_t>::max())
2727
};
2828

2929
static constexpr uint64_t get_hash(const int32_t value) noexcept
@@ -44,9 +44,9 @@ public:
4444

4545
while (i >= 0)
4646
{
47-
const auto& [hash_code, next, value1] = entries[i];
47+
const auto& [next, value1] = entries[i];
4848

49-
if (hash_code == hash && value1 == value)
49+
if (value1 == value)
5050
return true;
5151

5252
i = next;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ class HashSetChainStructure_Int64_5 final
1010
{
1111
struct e
1212
{
13-
uint64_t hash_code;
13+
1414
int8_t next;
1515
int64_t value;
1616

17-
e(const uint64_t hash_code, const int8_t next, const int64_t value)
18-
: hash_code(hash_code), next(next), value(value) {}
17+
e(const int8_t next, const int64_t value)
18+
: next(next), value(value) {}
1919
};
2020

2121
static constexpr std::array<int8_t, 5> buckets = {
2222
3, 5, 0, 1, 0
2323
};
2424

2525
inline static const std::array<e, 5> entries = {
26-
e(9223372036854775808, -1, std::numeric_limits<int64_t>::lowest()), e(18446744073709551611, -1, -5ll), e(0, -1, 0ll), e(1, 1, 1ll), e(9223372036854775806, 3, 9223372036854775806ll)
26+
e(-1, std::numeric_limits<int64_t>::lowest()), e(-1, -5ll), e(-1, 0ll), e(1, 1ll), e(3, 9223372036854775806ll)
2727
};
2828

2929
static uint64_t get_hash(const int64_t value) noexcept
@@ -44,9 +44,9 @@ public:
4444

4545
while (i >= 0)
4646
{
47-
const auto& [hash_code, next, value1] = entries[i];
47+
const auto& [next, value1] = entries[i];
4848

49-
if (hash_code == hash && value1 == value)
49+
if (value1 == value)
5050
return true;
5151

5252
i = next;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ class HashSetChainStructure_SByte_5 final
1010
{
1111
struct e
1212
{
13-
uint64_t hash_code;
13+
1414
int8_t next;
1515
int8_t value;
1616

17-
e(const uint64_t hash_code, const int8_t next, const int8_t value)
18-
: hash_code(hash_code), next(next), value(value) {}
17+
e(const int8_t next, const int8_t value)
18+
: next(next), value(value) {}
1919
};
2020

2121
static constexpr std::array<int8_t, 5> buckets = {
2222
3, 4, 5, 1, 0
2323
};
2424

2525
inline static const std::array<e, 5> entries = {
26-
e(18446744073709551488, -1, std::numeric_limits<int8_t>::lowest()), e(18446744073709551615, -1, -1), e(0, 1, 0), e(1, -1, 1), e(127, -1, std::numeric_limits<int8_t>::max())
26+
e(-1, std::numeric_limits<int8_t>::lowest()), e(-1, -1), e(1, 0), e(-1, 1), e(-1, std::numeric_limits<int8_t>::max())
2727
};
2828

2929
static constexpr uint64_t get_hash(const int8_t value) noexcept
@@ -44,9 +44,9 @@ public:
4444

4545
while (i >= 0)
4646
{
47-
const auto& [hash_code, next, value1] = entries[i];
47+
const auto& [next, value1] = entries[i];
4848

49-
if (hash_code == hash && value1 == value)
49+
if (value1 == value)
5050
return true;
5151

5252
i = next;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ class HashSetChainStructure_UInt16_4 final
1010
{
1111
struct e
1212
{
13-
uint64_t hash_code;
13+
1414
int8_t next;
1515
uint16_t value;
1616

17-
e(const uint64_t hash_code, const int8_t next, const uint16_t value)
18-
: hash_code(hash_code), next(next), value(value) {}
17+
e(const int8_t next, const uint16_t value)
18+
: next(next), value(value) {}
1919
};
2020

2121
static constexpr std::array<int8_t, 4> buckets = {
2222
1, 2, 3, 4
2323
};
2424

2525
inline static const std::array<e, 4> entries = {
26-
e(0, -1, 0), e(1, -1, 1), e(2, -1, 2), e(65535, -1, std::numeric_limits<uint16_t>::max())
26+
e(-1, 0), e(-1, 1), e(-1, 2), e(-1, std::numeric_limits<uint16_t>::max())
2727
};
2828

2929
static constexpr uint64_t get_hash(const uint16_t value) noexcept
@@ -44,9 +44,9 @@ public:
4444

4545
while (i >= 0)
4646
{
47-
const auto& [hash_code, next, value1] = entries[i];
47+
const auto& [next, value1] = entries[i];
4848

49-
if (hash_code == hash && value1 == value)
49+
if (value1 == value)
5050
return true;
5151

5252
i = next;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ class HashSetChainStructure_UInt32_4 final
1010
{
1111
struct e
1212
{
13-
uint64_t hash_code;
13+
1414
int8_t next;
1515
uint32_t value;
1616

17-
e(const uint64_t hash_code, const int8_t next, const uint32_t value)
18-
: hash_code(hash_code), next(next), value(value) {}
17+
e(const int8_t next, const uint32_t value)
18+
: next(next), value(value) {}
1919
};
2020

2121
static constexpr std::array<int8_t, 4> buckets = {
2222
1, 2, 3, 4
2323
};
2424

2525
inline static const std::array<e, 4> entries = {
26-
e(0, -1, 0), e(1, -1, 1u), e(2, -1, 2u), e(4294967295, -1, std::numeric_limits<uint32_t>::max())
26+
e(-1, 0), e(-1, 1u), e(-1, 2u), e(-1, std::numeric_limits<uint32_t>::max())
2727
};
2828

2929
static constexpr uint64_t get_hash(const uint32_t value) noexcept
@@ -44,9 +44,9 @@ public:
4444

4545
while (i >= 0)
4646
{
47-
const auto& [hash_code, next, value1] = entries[i];
47+
const auto& [next, value1] = entries[i];
4848

49-
if (hash_code == hash && value1 == value)
49+
if (value1 == value)
5050
return true;
5151

5252
i = next;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ class HashSetChainStructure_UInt64_4 final
1010
{
1111
struct e
1212
{
13-
uint64_t hash_code;
13+
1414
int8_t next;
1515
uint64_t value;
1616

17-
e(const uint64_t hash_code, const int8_t next, const uint64_t value)
18-
: hash_code(hash_code), next(next), value(value) {}
17+
e(const int8_t next, const uint64_t value)
18+
: next(next), value(value) {}
1919
};
2020

2121
static constexpr std::array<int8_t, 4> buckets = {
2222
1, 4, 3, 0
2323
};
2424

2525
inline static const std::array<e, 4> entries = {
26-
e(0, -1, 0), e(1, -1, 1ull), e(2, -1, 2ull), e(18446744073709551605, 1, 18446744073709551605ull)
26+
e(-1, 0), e(-1, 1ull), e(-1, 2ull), e(1, 18446744073709551605ull)
2727
};
2828

2929
static uint64_t get_hash(const uint64_t value) noexcept
@@ -44,9 +44,9 @@ public:
4444

4545
while (i >= 0)
4646
{
47-
const auto& [hash_code, next, value1] = entries[i];
47+
const auto& [next, value1] = entries[i];
4848

49-
if (hash_code == hash && value1 == value)
49+
if (value1 == value)
5050
return true;
5151

5252
i = next;

0 commit comments

Comments
 (0)