Fixed ArrayTypeMismatchException thrown on FishSets and Tables with certain reference type default values

This commit is contained in:
bbradson
2024-04-15 05:26:49 +02:00
parent 8d23bff6ba
commit 040a756d2e
12 changed files with 26 additions and 8 deletions
+3 -3
View File
@@ -157,7 +157,7 @@ public class FishSet<T> : ISet<T>, IReadOnlyCollection<T>, ICollection
// Mathf.NextPowerOfTwo(minimumCapacity);
_buckets = new T?[minimumCapacity];
Array.Fill(_buckets, _defaultValue);
_buckets.Fill(_defaultValue);
_tails = new((uint)minimumCapacity);
_bucketBitShift = 32 - FishMath.TrailingZeroCount((uint)_buckets.Length);
_wrapAroundMask = _buckets.Length - 1;
@@ -447,7 +447,7 @@ public class FishSet<T> : ISet<T>, IReadOnlyCollection<T>, ICollection
_tails = new((uint)_buckets.Length << 1);
_buckets = new T?[_buckets.Length << 1];
Array.Fill(_buckets, _defaultValue);
_buckets.Fill(_defaultValue);
_bucketBitShift = 32 - FishMath.TrailingZeroCount((uint)_buckets.Length);
_wrapAroundMask = _buckets.Length - 1;
@@ -618,7 +618,7 @@ public class FishSet<T> : ISet<T>, IReadOnlyCollection<T>, ICollection
if (_buckets is null)
Initialize();
Array.Fill(_buckets, _defaultValue);
_buckets.Fill(_defaultValue);
_tails.Reset();
_count = 0;