Skip to content

Commit 3800fb3

Browse files
committed
We no longer have hash collisions, so we can normalize edge cases
1 parent f44255b commit 3800fb3

File tree

37 files changed

+137
-141
lines changed

37 files changed

+137
-141
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
class ArrayStructure_Int64_5 final
1010
{
1111
static constexpr std::array<int64_t, 5> entries = {
12-
std::numeric_limits<int64_t>::lowest(), -5ll, 0ll, 1ll, 9223372036854775806ll
12+
std::numeric_limits<int64_t>::lowest(), -1ll, 0ll, 1ll, std::numeric_limits<int64_t>::max()
1313
};
1414

1515
public:
1616
[[nodiscard]]
1717
static bool contains(const int64_t value) noexcept
1818
{
19-
if (value < std::numeric_limits<int64_t>::lowest() || value > 9223372036854775806ll)
19+
if (value < std::numeric_limits<int64_t>::lowest() || value > std::numeric_limits<int64_t>::max())
2020
return false;
2121

2222
for (size_t i = 0; i < 5; i++)
@@ -29,7 +29,7 @@ public:
2929

3030
static constexpr size_t item_count = 5;
3131
static constexpr int64_t min_value = std::numeric_limits<int64_t>::lowest();
32-
static constexpr int64_t max_value = 9223372036854775806ll;
32+
static constexpr int64_t max_value = std::numeric_limits<int64_t>::max();
3333

3434
public:
3535
ArrayStructure_Int64_5() = delete;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
class ArrayStructure_UInt64_4 final
1010
{
1111
static constexpr std::array<uint64_t, 4> entries = {
12-
0, 1ull, 2ull, 18446744073709551605ull
12+
0, 1ull, 2ull, std::numeric_limits<uint64_t>::max()
1313
};
1414

1515
public:
1616
[[nodiscard]]
1717
static bool contains(const uint64_t value) noexcept
1818
{
19-
if (value < 0 || value > 18446744073709551605ull)
19+
if (value < 0 || value > std::numeric_limits<uint64_t>::max())
2020
return false;
2121

2222
for (size_t i = 0; i < 4; i++)
@@ -29,7 +29,7 @@ public:
2929

3030
static constexpr size_t item_count = 4;
3131
static constexpr uint64_t min_value = 0;
32-
static constexpr uint64_t max_value = 18446744073709551605ull;
32+
static constexpr uint64_t max_value = std::numeric_limits<uint64_t>::max();
3333

3434
public:
3535
ArrayStructure_UInt64_4() = delete;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
class BinarySearchStructure_Int64_5 final
1010
{
1111
static constexpr std::array<int64_t, 5> entries = {
12-
std::numeric_limits<int64_t>::lowest(), -5ll, 0ll, 1ll, 9223372036854775806ll
12+
std::numeric_limits<int64_t>::lowest(), -1ll, 0ll, 1ll, std::numeric_limits<int64_t>::max()
1313
};
1414

1515
public:
1616
[[nodiscard]]
1717
static bool contains(const int64_t value) noexcept
1818
{
19-
if (value < std::numeric_limits<int64_t>::lowest() || value > 9223372036854775806ll)
19+
if (value < std::numeric_limits<int64_t>::lowest() || value > std::numeric_limits<int64_t>::max())
2020
return false;
2121

2222
size_t lo = 0;
@@ -39,7 +39,7 @@ public:
3939

4040
static constexpr size_t item_count = 5;
4141
static constexpr int64_t min_value = std::numeric_limits<int64_t>::lowest();
42-
static constexpr int64_t max_value = 9223372036854775806ll;
42+
static constexpr int64_t max_value = std::numeric_limits<int64_t>::max();
4343

4444
public:
4545
BinarySearchStructure_Int64_5() = delete;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
class BinarySearchStructure_UInt64_4 final
1010
{
1111
static constexpr std::array<uint64_t, 4> entries = {
12-
0, 1ull, 2ull, 18446744073709551605ull
12+
0, 1ull, 2ull, std::numeric_limits<uint64_t>::max()
1313
};
1414

1515
public:
1616
[[nodiscard]]
1717
static bool contains(const uint64_t value) noexcept
1818
{
19-
if (value < 0 || value > 18446744073709551605ull)
19+
if (value < 0 || value > std::numeric_limits<uint64_t>::max())
2020
return false;
2121

2222
size_t lo = 0;
@@ -39,7 +39,7 @@ public:
3939

4040
static constexpr size_t item_count = 4;
4141
static constexpr uint64_t min_value = 0;
42-
static constexpr uint64_t max_value = 18446744073709551605ull;
42+
static constexpr uint64_t max_value = std::numeric_limits<uint64_t>::max();
4343

4444
public:
4545
BinarySearchStructure_UInt64_4() = delete;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ public:
1212
[[nodiscard]]
1313
static bool contains(const int64_t value) noexcept
1414
{
15-
if (value < std::numeric_limits<int64_t>::lowest() || value > 9223372036854775806ll)
15+
if (value < std::numeric_limits<int64_t>::lowest() || value > std::numeric_limits<int64_t>::max())
1616
return false;
1717

18-
if (value == std::numeric_limits<int64_t>::lowest() || value == -5ll || value == 0ll || value == 1ll || value == 9223372036854775806ll)
18+
if (value == std::numeric_limits<int64_t>::lowest() || value == -1ll || value == 0ll || value == 1ll || value == std::numeric_limits<int64_t>::max())
1919
return true;
2020

2121
return false;
2222
}
2323

2424
static constexpr size_t item_count = 5;
2525
static constexpr int64_t min_value = std::numeric_limits<int64_t>::lowest();
26-
static constexpr int64_t max_value = 9223372036854775806ll;
26+
static constexpr int64_t max_value = std::numeric_limits<int64_t>::max();
2727

2828
public:
2929
ConditionalStructure_Int64_5() = delete;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ public:
1212
[[nodiscard]]
1313
static bool contains(const uint64_t value) noexcept
1414
{
15-
if (value < 0 || value > 18446744073709551605ull)
15+
if (value < 0 || value > std::numeric_limits<uint64_t>::max())
1616
return false;
1717

18-
if (value == 0 || value == 1ull || value == 2ull || value == 18446744073709551605ull)
18+
if (value == 0 || value == 1ull || value == 2ull || value == std::numeric_limits<uint64_t>::max())
1919
return true;
2020

2121
return false;
2222
}
2323

2424
static constexpr size_t item_count = 4;
2525
static constexpr uint64_t min_value = 0;
26-
static constexpr uint64_t max_value = 18446744073709551605ull;
26+
static constexpr uint64_t max_value = std::numeric_limits<uint64_t>::max();
2727

2828
public:
2929
ConditionalStructure_UInt64_4() = delete;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
class EytzingerSearchStructure_Int64_5 final
1010
{
1111
static constexpr std::array<int64_t, 5> entries = {
12-
1ll, -5ll, 9223372036854775806ll, std::numeric_limits<int64_t>::lowest(), 0ll
12+
1ll, -1ll, std::numeric_limits<int64_t>::max(), std::numeric_limits<int64_t>::lowest(), 0ll
1313
};
1414

1515
public:
1616
[[nodiscard]]
1717
static bool contains(const int64_t value) noexcept
1818
{
19-
if (value < std::numeric_limits<int64_t>::lowest() || value > 9223372036854775806ll)
19+
if (value < std::numeric_limits<int64_t>::lowest() || value > std::numeric_limits<int64_t>::max())
2020
return false;
2121

2222
size_t i = 0;
@@ -36,7 +36,7 @@ public:
3636

3737
static constexpr size_t item_count = 5;
3838
static constexpr int64_t min_value = std::numeric_limits<int64_t>::lowest();
39-
static constexpr int64_t max_value = 9223372036854775806ll;
39+
static constexpr int64_t max_value = std::numeric_limits<int64_t>::max();
4040

4141
public:
4242
EytzingerSearchStructure_Int64_5() = delete;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
class EytzingerSearchStructure_UInt64_4 final
1010
{
1111
static constexpr std::array<uint64_t, 4> entries = {
12-
2ull, 1ull, 18446744073709551605ull, 0
12+
2ull, 1ull, std::numeric_limits<uint64_t>::max(), 0
1313
};
1414

1515
public:
1616
[[nodiscard]]
1717
static bool contains(const uint64_t value) noexcept
1818
{
19-
if (value < 0 || value > 18446744073709551605ull)
19+
if (value < 0 || value > std::numeric_limits<uint64_t>::max())
2020
return false;
2121

2222
size_t i = 0;
@@ -36,7 +36,7 @@ public:
3636

3737
static constexpr size_t item_count = 4;
3838
static constexpr uint64_t min_value = 0;
39-
static constexpr uint64_t max_value = 18446744073709551605ull;
39+
static constexpr uint64_t max_value = std::numeric_limits<uint64_t>::max();
4040

4141
public:
4242
EytzingerSearchStructure_UInt64_4() = delete;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ class HashSetChainStructure_Int64_5 final
1919
};
2020

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

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

2929
static uint64_t get_hash(const int64_t value) noexcept
@@ -35,7 +35,7 @@ public:
3535
[[nodiscard]]
3636
static bool contains(const int64_t value) noexcept
3737
{
38-
if (value < std::numeric_limits<int64_t>::lowest() || value > 9223372036854775806ll)
38+
if (value < std::numeric_limits<int64_t>::lowest() || value > std::numeric_limits<int64_t>::max())
3939
return false;
4040

4141
const uint64_t hash = get_hash(value);
@@ -57,7 +57,7 @@ public:
5757

5858
static constexpr size_t item_count = 5;
5959
static constexpr int64_t min_value = std::numeric_limits<int64_t>::lowest();
60-
static constexpr int64_t max_value = 9223372036854775806ll;
60+
static constexpr int64_t max_value = std::numeric_limits<int64_t>::max();
6161

6262
public:
6363
HashSetChainStructure_Int64_5() = delete;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ class HashSetChainStructure_UInt64_4 final
1919
};
2020

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

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

2929
static uint64_t get_hash(const uint64_t value) noexcept
@@ -35,7 +35,7 @@ public:
3535
[[nodiscard]]
3636
static bool contains(const uint64_t value) noexcept
3737
{
38-
if (value < 0 || value > 18446744073709551605ull)
38+
if (value < 0 || value > std::numeric_limits<uint64_t>::max())
3939
return false;
4040

4141
const uint64_t hash = get_hash(value);
@@ -57,7 +57,7 @@ public:
5757

5858
static constexpr size_t item_count = 4;
5959
static constexpr uint64_t min_value = 0;
60-
static constexpr uint64_t max_value = 18446744073709551605ull;
60+
static constexpr uint64_t max_value = std::numeric_limits<uint64_t>::max();
6161

6262
public:
6363
HashSetChainStructure_UInt64_4() = delete;

0 commit comments

Comments
 (0)