fix (kernel): fixed a bug in optimized memory functions, that caused the 8-bit part to not be processed

This commit is contained in:
antifallobst 2023-02-24 01:20:10 +01:00
parent eac9754a4d
commit 13e1a15232
1 changed files with 8 additions and 8 deletions

View File

@ -28,10 +28,10 @@ void memory_copy(void* source, void* destination, uint32_t num) {
} }
uint32_t num_8 = num % 8; uint32_t num_8 = num % 8;
uint8_t* src_8 = (uint8_t*)source; uint8_t* src_8 = &((uint8_t*)source)[num_64 * 8];
uint8_t* dst_8 = (uint8_t*)destination; uint8_t* dst_8 = &((uint8_t*)destination)[num_64 * 8];
for (uint32_t i = num_64 * 8; i < num_8; i++) { for (uint32_t i = 0; i < num_8; i++) {
dst_8[i] = src_8[i]; dst_8[i] = src_8[i];
} }
} }
@ -48,9 +48,9 @@ void memory_set(void* destination, uint8_t data, uint32_t num) {
} }
uint32_t num_8 = num % 8; uint32_t num_8 = num % 8;
uint8_t* dst_8 = (uint8_t*)destination; uint8_t* dst_8 = &((uint8_t*)destination)[num_64 * 8];
for (uint32_t i = num_64 * 8; i < num_8; i++) { for (uint32_t i = 0; i < num_8; i++) {
dst_8[i] = data; dst_8[i] = data;
} }
} }
@ -67,10 +67,10 @@ bool memory_compare(void* a, void* b, uint32_t num) {
} }
uint32_t num_8 = num % 8; uint32_t num_8 = num % 8;
uint8_t* a_8 = (uint8_t*)a; uint8_t* a_8 = &((uint8_t*)a)[num_64 * 8];
uint8_t* b_8 = (uint8_t*)b; uint8_t* b_8 = &((uint8_t*)b)[num_64 * 8];
for (uint32_t i = num_64 * 8; i < num_8; i++) { for (uint32_t i = 0; i < num_8; i++) {
if (a_8[i] != b_8[i]) { if (a_8[i] != b_8[i]) {
return false; return false;
} }