@@ -282,16 +282,21 @@ public interface IEntries<K, V, TEq> where TEq : IEq<K>
282
282
283
283
internal const int MinEntriesCapacity = 2 ;
284
284
285
- public struct SingleArrayEntries < K , V , TEq > : IEntries < K , V , TEq > where TEq : struct , IEq < K >
285
+ /// <summary>Stores the entries in a single dynamically reallocated array</summary>
286
+ public struct SingleArrayEntries < K , V , TEq > : IEntries < K , V , TEq > where TEq : struct , IEq < K >
286
287
{
287
288
int _entryCount ;
288
289
internal Entry < K , V > [ ] _entries ;
290
+
291
+ /// <inheritdoc/>
289
292
public void Init ( byte capacityBitShift ) =>
290
293
_entries = new Entry < K , V > [ 1 << capacityBitShift ] ;
291
294
295
+ /// <inheritdoc/>
292
296
[ MethodImpl ( ( MethodImplOptions ) 256 ) ]
293
297
public int GetCount ( ) => _entryCount ;
294
298
299
+ /// <inheritdoc/>
295
300
[ MethodImpl ( ( MethodImplOptions ) 256 ) ]
296
301
public ref Entry < K , V > GetSurePresentEntryRef ( int index )
297
302
{
@@ -302,6 +307,7 @@ public ref Entry<K, V> GetSurePresentEntryRef(int index)
302
307
#endif
303
308
}
304
309
310
+ /// <inheritdoc/>
305
311
[ MethodImpl ( ( MethodImplOptions ) 256 ) ]
306
312
public ref V AddKeyAndGetValueRef ( K key )
307
313
{
@@ -325,6 +331,7 @@ public ref V AddKeyAndGetValueRef(K key)
325
331
return ref e . Value ;
326
332
}
327
333
334
+ /// <summary>Tombstones the entry key</summary>
328
335
[ MethodImpl ( ( MethodImplOptions ) 256 ) ]
329
336
public void TombstoneOrRemoveSurePresentEntry ( int index )
330
337
{
@@ -334,25 +341,29 @@ public void TombstoneOrRemoveSurePresentEntry(int index)
334
341
}
335
342
336
343
// todo: @improve make it configurable
337
- const byte ChunkCapacityBitShift = 8 ; // 8 bits == 256
338
- const int ChunkCapacity = 1 << ChunkCapacityBitShift ;
339
- const int ChunkCapacityMask = ChunkCapacity - 1 ;
344
+ /// <summary>The capacity of chunk in bits for <see cref="ChunkedArrayEntries{K, V, TEq}"/></summary>
345
+ public const byte ChunkCapacityBitShift = 8 ; // 8 bits == 256
346
+ internal const int ChunkCapacity = 1 << ChunkCapacityBitShift ;
347
+ internal const int ChunkCapacityMask = ChunkCapacity - 1 ;
340
348
341
349
// todo: @perf research on the similar growable indexed collection with append-to-end semantics
342
- /// <summary>The array of array buckets, where bucket is the fixed size.
350
+ /// <summary>The array of array buckets, where bucket is the fixed size.
343
351
/// It enables adding the new bucket without for the new entries without reallocating the existing data.
344
352
/// It may allow to drop the empty bucket as well, reclaiming the memory after remove.
345
353
/// The structure is similar to Hashed Array Tree (HAT)</summary>
346
354
public struct ChunkedArrayEntries < K , V , TEq > : IEntries < K , V , TEq > where TEq : struct , IEq < K >
347
355
{
348
356
int _entryCount ;
349
357
Entry < K , V > [ ] [ ] _entries ;
358
+ /// <inheritdoc/>
350
359
public void Init ( byte capacityBitShift ) =>
351
360
_entries = new [ ] { new Entry < K , V > [ ( 1 << capacityBitShift ) & ChunkCapacityMask ] } ;
352
361
362
+ /// <inheritdoc/>
353
363
[ MethodImpl ( ( MethodImplOptions ) 256 ) ]
354
364
public int GetCount ( ) => _entryCount ;
355
365
366
+ /// <inheritdoc/>
356
367
[ MethodImpl ( ( MethodImplOptions ) 256 ) ]
357
368
public ref Entry < K , V > GetSurePresentEntryRef ( int index )
358
369
{
@@ -364,6 +375,7 @@ public ref Entry<K, V> GetSurePresentEntryRef(int index)
364
375
#endif
365
376
}
366
377
378
+ /// <inheritdoc/>
367
379
public ref V AddKeyAndGetValueRef ( K key )
368
380
{
369
381
var index = _entryCount ++ ;
@@ -426,6 +438,7 @@ public ref V AddKeyAndGetValueRef(K key)
426
438
}
427
439
}
428
440
441
+ /// <summary>Tombstones the entry key</summary>
429
442
[ MethodImpl ( ( MethodImplOptions ) 256 ) ]
430
443
public void TombstoneOrRemoveSurePresentEntry ( int index )
431
444
{
0 commit comments