コード例 #1
0
 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)];
 }
コード例 #2
0
 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)];
 }
コード例 #3
0
 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);
 }
コード例 #4
0
        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);
        }
コード例 #5
0
 public SpanDictionary(uint size, IAllocationStrategy allocationStrategy) : this()
 {
     _valuesInfo = new Node[size];
     _values     = allocationStrategy.Allocate <TValue>(size);
     _buckets    = new int[HashHelpers.GetPrime((int)size)];
 }
コード例 #6
0
 public FasterDictionary(uint size)
 {
     _valuesInfo = new Node[size];
     _values     = new TValue[size];
     _buckets    = new int[HashHelpers.GetPrime((int)size)];
 }