itinero / reminiscence

A library for cross-platform memory mapping.
MIT License
9 stars 6 forks source link

MemoryArray<T>: Custom Block Size Won't Quite Work #5

Closed airbreather closed 5 years ago

airbreather commented 7 years ago

These lines use _arrayPow, which looks like it was supposed to be the log-base-2 of the block size, but it's never actually set except inline, so if you try to use a smaller block size then there will be some values that can only be written to (never read from).

For example:

var arr = new MemoryArray<int>(17, 16);
arr[15] = 1;
Console.WriteLine(arr[15]); // writes 1
arr[16] = 2;
Console.WriteLine(arr[16]); // throws