Wsm2110 / Faster.Map

Faster.Map is a high-performance, thread-safe key-value store designed to outperform the standard Dictionary and ConcurrentDictionary
MIT License
75 stars 7 forks source link

DenseMapSIMD Throws IndexOutOfRangeException inside Contains #28

Closed NightlyRevenger closed 1 year ago

NightlyRevenger commented 1 year ago

DenseMapSIMD Throws IndexOutOfRangeException inside Contains when small length was passed into constructor.

Minimum working example:

var fmap = new DenseMapSIMD<long, long>(1);
fmap.Emplace(0L, 0L);

var r = fmap.Contains(1);

The piece of code above throws IndexOutOfRangeException inside GetArrayEntryRef Most likely the reason is length instead of _length here:

https://github.com/Wsm2110/Faster.Map/blob/27ede7ac7717dfc54c9d81e99e76f5e859ba69d7/src/DenseMapSIMD.cs#L174-L177

Wsm2110 commented 1 year ago

Fixed