read_tsc_64(&tsc);
totalsize = block_get_totalsize(size);
page_index_max = (ptr_max - ptr_min - totalsize) / PAGE_SIZE;
- page_index = rem64u(tsc, page_index_max);
+ page_index = (page_index_max > 0) ? (tsc.lo % page_index_max) : 0;
ptr = ptr_min + page_index * PAGE_SIZE;
/* allocate block */
}
/* block may not be at the requested location if that is in use */
- if (ptr_min < (u8_t *) block)
+ if (ptr_min > (u8_t *) block)
ptr_min = (u8_t *) block;
if (ptr_max < (u8_t *) block)