mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 01:54:09 +08:00
xtensa: fix str[n]cmp return value
str[n]cmp functions return negative value if the first string is less than the second, positive value if the first string is greater than the second and zero if they are equal. This is important when these functions are used for sorting/binary search. With incorrect strcmp return value bsearch was always failing in the find_symbol_in_section making it impossible to load any module. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Chris Zankel <chris@zankel.net>
This commit is contained in:
parent
de73b6b1bd
commit
c5a285bb1b
@ -74,7 +74,7 @@ static inline int strcmp(const char *__cs, const char *__ct)
|
||||
"beqz %2, 2f\n\t"
|
||||
"beq %2, %3, 1b\n"
|
||||
"2:\n\t"
|
||||
"sub %2, %3, %2"
|
||||
"sub %2, %2, %3"
|
||||
: "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&r" (__dummy)
|
||||
: "0" (__cs), "1" (__ct));
|
||||
|
||||
@ -99,7 +99,7 @@ static inline int strncmp(const char *__cs, const char *__ct, size_t __n)
|
||||
"beqz %3, 2f\n\t"
|
||||
"beq %2, %3, 1b\n"
|
||||
"2:\n\t"
|
||||
"sub %2, %3, %2"
|
||||
"sub %2, %2, %3"
|
||||
: "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&r" (__dummy)
|
||||
: "0" (__cs), "1" (__ct), "r" (__cs+__n));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user