Commit c2c32b4
committed
Add LongDictionary<TValue> for 64-bit keys
Mirrors the IntDictionary surface for `long` keys: convenience subclass
defaulting to Int64WangHasher, generic LongDictionary<TValue, THasher>
base class implementing IReadOnlyDictionary<long, TValue?>, struct
Enumerator + KeyCollection / ValueCollection allocation-free views,
the IEnumerable<KeyValuePair<long,TValue>> constructor, full
Add/TryAdd/TryGetValue/Clear surface, and constructor validation.
The zero key (0L) collides with the EMPTY_KEY sentinel exactly as on
IntDictionary and is stored out-of-band via _hasZeroKey + _zeroValue.
Tests mirror the IntDictionary coverage and add long-specific cases:
extreme keys (long.MinValue / long.MaxValue / boundaries around the
int range / -1L) and a regression test that two keys sharing the same
lower 32 bits but differing in the upper 32 bits are kept distinct
(guards against any accidental int-truncation on the probe path).
Closes the last collection-shape gap on milestone 1.1.0.1 parent 4378904 commit c2c32b4
4 files changed
Lines changed: 1152 additions & 1 deletion
File tree
- src
- Celerity.Tests/Collections
- Celerity/Collections
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
0 commit comments