fwrite_le.c: optimize for FWRITE_LE_NO_MODIFICATION case
This commit is contained in:
parent
ff5608e0d0
commit
b3a635076b
@ -49,9 +49,14 @@ size_t fwrite_le(void* ptr, size_t size, size_t count, FILE* stream) {
|
||||
const size_t div_size = size >> 1; // divide by 2
|
||||
for (size_t j = 0; j < div_size; j++) {
|
||||
const size_t old_pos = i + j, new_pos = i + size - j - 1;
|
||||
#if FWRITE_LE_NO_MODIFICATION
|
||||
bytes[old_pos] = ptr[new_pos];
|
||||
bytes[new_pos] = ptr[old_pos];
|
||||
#else
|
||||
uint8_t temp = bytes[old_pos];
|
||||
bytes[old_pos] = bytes[new_pos];
|
||||
bytes[new_pos] = temp;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user