Oops, fix fio_realloc to use the new fio_realloc2 function
@@ -45,9 +45,7 @@ static inline void fio_memcpy(uint16_t *__restrict dest,
uint16_t *__restrict src, size_t units) {
units = units << 3;
#endif
- while (units) {
- switch (units) { /* unroll loop */
- default:
+ while (units >= 16) { /* unroll loop */
dest[0] = src[0];
dest[1] = src[1];
dest[2] = src[2];
@@ -67,7 +65,8 @@ static inline void fio_memcpy(uint16_t *__restrict dest,
dest += 16;
src += 16;
units -= 16;
- break;
+ }
+ switch (units) {
case 15:
*(dest++) = *(src++); /* fallthrough */
case 14:
@@ -99,8 +98,6 @@ static inline void fio_memcpy(uint16_t *__restrict dest,
case 1:
*(dest++) = *(src++);
units = 0;
- break;
- }
}
}
@@ -483,7 +480,7 @@ void *fio_realloc2(void *ptr, size_t new_size, size_t copy_length) {
void *fio_realloc(void *ptr, size_t new_size) {
const size_t max_old =
FIO_MEMORY_BLOCK_SIZE - ((uintptr_t)ptr & FIO_MEMORY_BLOCK_MASK);
- return fio_realloc2(ptr, max_old, new_size);
+ return fio_realloc2(ptr, new_size, max_old);
}
/* *****************************************************************************
