Fix marker indexing

This commit is contained in:
Luke Benstead 2019-02-28 08:34:32 +00:00
parent 11b26c78d5
commit 3345e17e3c

View File

@ -61,7 +61,7 @@ void* named_array_alloc(NamedArray* array, unsigned int* new_id) {
void* named_array_reserve(NamedArray* array, unsigned int id) { void* named_array_reserve(NamedArray* array, unsigned int id) {
if(!named_array_used(array, id)) { if(!named_array_used(array, id)) {
unsigned int j = (id % 8) - 1; unsigned int j = (id % 8) - 1;
unsigned int i = (id - j) / 8; unsigned int i = id / 8;
assert(!named_array_used(array, id)); assert(!named_array_used(array, id));
array->used_markers[i] |= (unsigned char) 1 << j; array->used_markers[i] |= (unsigned char) 1 << j;