aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386/i486
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2003-09-05 10:03:19 +0000
committerAndreas Jaeger <aj@suse.de>2003-09-05 10:03:19 +0000
commitb7f75e247b5d1c8c3d6342191e03545763e66235 (patch)
tree96a59efbe89a8c46940fc526e7c077a1bc81ed0c /sysdeps/i386/i486
parent6ae3b383a5e2148f07f4c25486961b528645288f (diff)
downloadglibc-b7f75e247b5d1c8c3d6342191e03545763e66235.zip
glibc-b7f75e247b5d1c8c3d6342191e03545763e66235.tar.gz
glibc-b7f75e247b5d1c8c3d6342191e03545763e66235.tar.bz2
Update.
* sysdeps/i386/bits/string.h (__memrchr): Do addition in assembler to make it conforming C. * sysdeps/i386/i486/bits/string.h (__memrchr): Likewise.
Diffstat (limited to 'sysdeps/i386/i486')
-rw-r--r--sysdeps/i386/i486/bits/string.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h
index 54ff2e0..2a6aa48 100644
--- a/sysdeps/i386/i486/bits/string.h
+++ b/sysdeps/i386/i486/bits/string.h
@@ -484,7 +484,8 @@ __memrchr (__const void *__s, int __c, size_t __n)
("std\n\t"
"repne; scasb\n\t"
"cmovne %2,%0\n\t"
- "cld"
+ "cld\n\t"
+ "incl %0"
: "=D" (__res), "=&c" (__d0), "=&r" (__d1)
: "a" (__c), "0" (__s + __n - 1), "1" (__n), "2" (-1),
"m" ( *(struct { __extension__ char __x[__n]; } *)__s)
@@ -495,13 +496,14 @@ __memrchr (__const void *__s, int __c, size_t __n)
"repne; scasb\n\t"
"je 1f\n\t"
"orl $-1,%0\n"
- "1:\tcld"
+ "1:\tcld\n\t"
+ "incl %0"
: "=D" (__res), "=&c" (__d0)
: "a" (__c), "0" (__s + __n - 1), "1" (__n),
"m" ( *(struct { __extension__ char __x[__n]; } *)__s)
: "cc");
# endif
- return __res + 1;
+ return __res;
}
# ifdef __USE_GNU
# define memrchr(s, c, n) __memrchr ((s), (c), (n))