mirror of
https://github.com/MiSTer-devel/Linux-Kernel_MiSTer.git
synced 2026-04-19 03:04:24 +00:00
v5.15.1
This commit is contained in:
16
lib/string.c
16
lib/string.c
@@ -29,6 +29,7 @@
|
||||
#include <linux/errno.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <asm/unaligned.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/word-at-a-time.h>
|
||||
#include <asm/page.h>
|
||||
@@ -935,6 +936,21 @@ __visible int memcmp(const void *cs, const void *ct, size_t count)
|
||||
const unsigned char *su1, *su2;
|
||||
int res = 0;
|
||||
|
||||
#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
if (count >= sizeof(unsigned long)) {
|
||||
const unsigned long *u1 = cs;
|
||||
const unsigned long *u2 = ct;
|
||||
do {
|
||||
if (get_unaligned(u1) != get_unaligned(u2))
|
||||
break;
|
||||
u1++;
|
||||
u2++;
|
||||
count -= sizeof(unsigned long);
|
||||
} while (count >= sizeof(unsigned long));
|
||||
cs = u1;
|
||||
ct = u2;
|
||||
}
|
||||
#endif
|
||||
for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
|
||||
if ((res = *su1 - *su2) != 0)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user