public SveltoDictionaryGeneric(uint size) { _valuesInfo = new FasterDictionaryNode <TKey> [size]; _values = default; _values.Alloc(size); DBC.Common.Check.Ensure(_values.capacity == _valuesInfo.Length, "invalid buffer size"); _buckets = new int[HashHelpers.GetPrime((int)size)]; }
public SveltoDictionary(uint size, IBufferStrategy <TValue> allocationStrategy) { _valuesInfo = new FasterDictionaryNode <TKey> [size]; _values = allocationStrategy; _values.Alloc(size); DBC.Common.Check.Ensure(_values.capacity == _valuesInfo.Length, "invalid buffer size"); _buckets = new int[HashHelpers.GetPrime((int)size)]; }
public SveltoDictionary(uint size, Allocator nativeAllocator) : this() { //AllocationStrategy must be passed external for TValue because SveltoDictionary doesn't have struct //constraint needed for the NativeVersion _valuesInfo = default; _valuesInfo.Alloc(size, nativeAllocator); _values = default; _values.Alloc(size, nativeAllocator); _buckets = default; _buckets.Alloc((uint)HashHelpers.GetPrime((int)size), nativeAllocator); }
public SveltoDictionary(uint size, IBufferStrategy <TValue> allocationStrategy) { //AllocationStrategy must be passed external for TValue because SveltoDictionary doesn't have struct //constraint needed for the NativeVersion if (UnmanagedTypeExtensions.IsUnmanaged <TKey>() == false || UnmanagedTypeExtensions.IsUnmanaged <TValue>() == false) { _valuesInfo = new ManagedStrategy <FasterDictionaryNode <TKey> >(size); } else { _valuesInfo = new NativeStrategy <FasterDictionaryNode <TKey> >(size); } _buckets = new int[HashHelpers.GetPrime((int)size)]; _values = allocationStrategy; _values.Alloc(size); }
public SpanDictionary(uint size, IAllocationStrategy allocationStrategy) : this() { _valuesInfo = new Node[size]; _values = allocationStrategy.Allocate <TValue>(size); _buckets = new int[HashHelpers.GetPrime((int)size)]; }
public FasterDictionary(uint size) { _valuesInfo = new Node[size]; _values = new TValue[size]; _buckets = new int[HashHelpers.GetPrime((int)size)]; }