Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ConfigurableArrayPool() [2/2]

System.Buffers.ConfigurableArrayPool< T >.ConfigurableArrayPool ( int maxArrayLength,
int maxArraysPerBucket )
inlinepackage

Definition at line 109 of file ConfigurableArrayPool.cs.

110 {
111 if (maxArrayLength <= 0)
112 {
113 throw new ArgumentOutOfRangeException("maxArrayLength");
114 }
115 if (maxArraysPerBucket <= 0)
116 {
117 throw new ArgumentOutOfRangeException("maxArraysPerBucket");
118 }
119 if (maxArrayLength > 1073741824)
120 {
121 maxArrayLength = 1073741824;
122 }
123 else if (maxArrayLength < 16)
124 {
125 maxArrayLength = 16;
126 }
127 int id = Id;
128 int num = Utilities.SelectBucketIndex(maxArrayLength);
129 Bucket[] array = new Bucket[num + 1];
130 for (int i = 0; i < array.Length; i++)
131 {
132 array[i] = new Bucket(Utilities.GetMaxSizeForBucket(i), maxArraysPerBucket, id);
133 }
134 _buckets = array;
135 }

References System.Buffers.ConfigurableArrayPool< T >._buckets, System.array, System.Buffers.Utilities.GetMaxSizeForBucket(), System.Buffers.ConfigurableArrayPool< T >.Id, and System.Buffers.Utilities.SelectBucketIndex().