aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-05-01 00:16:16 +0000
committerUlrich Drepper <drepper@redhat.com>1999-05-01 00:16:16 +0000
commit0d3fe819f6e584ccd1146ffba91c24ae06374ffa (patch)
tree60f969cdbf1d60f9835f7ea8d5cd101a6c6a3b82 /sysdeps/i386
parent23f5f62d4b31c442f5bd49c64982e4e40935bc33 (diff)
downloadglibc-0d3fe819f6e584ccd1146ffba91c24ae06374ffa.tar
glibc-0d3fe819f6e584ccd1146ffba91c24ae06374ffa.tar.gz
glibc-0d3fe819f6e584ccd1146ffba91c24ae06374ffa.tar.bz2
glibc-0d3fe819f6e584ccd1146ffba91c24ae06374ffa.zip
Update.
1999-05-01 Ulrich Drepper <drepper@cygnus.com> * sysdeps/i386/i486/bits/string.h: Don't use and define __memset_gg. Prevent warnings from multiplication with 0x01010101 by another cast.
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/i486/bits/string.h56
1 files changed, 19 insertions, 37 deletions
diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h
index 2317d3f696..70a60005bb 100644
--- a/sysdeps/i386/i486/bits/string.h
+++ b/sysdeps/i386/i486/bits/string.h
@@ -190,18 +190,16 @@ memcmp (__const void *__s1, __const void *__s2, size_t __n)
#define _HAVE_STRING_ARCH_memset 1
#define memset(s, c, n) \
(__extension__ (__builtin_constant_p (n) && (n) <= 16 \
- ? (__builtin_constant_p (c) \
- ? __memset_gc (s, ((unsigned char) (c)) * 0x01010101, n) \
- : ((n) == 1 \
- ? __memset_c1 (s, c) \
- : __memset_gc (s, c, n))) \
+ ? ((n) == 1 \
+ ? __memset_c1 (s, c) \
+ : __memset_gc (s, c, n)) \
: (__builtin_constant_p (c) \
? (__builtin_constant_p (n) \
? __memset_ccn (s, c, n) \
- : __memset_gg (s, c, n)) \
+ : memset (s, c, n)) \
: (__builtin_constant_p (n) \
? __memset_gcn (s, c, n) \
- : __memset_gg (s, c, n)))))
+ : memset (s, c, n)))))
#define __memset_c1(s, c) ({ void *__s = (s); \
*((unsigned char *) __s) = (unsigned char) (c); \
@@ -210,7 +208,7 @@ memcmp (__const void *__s1, __const void *__s2, size_t __n)
#define __memset_gc(s, c, n) \
({ void *__s = (s); \
unsigned int *__ts = (unsigned int *) __s; \
- unsigned int __c = ((unsigned char) (c)) * 0x01010101; \
+ unsigned int __c = ((unsigned int) ((unsigned char) (c))) * 0x01010101; \
\
/* We apply a trick here. `gcc' would implement the following \
assignments using absolute operands. But this uses to much \
@@ -268,15 +266,19 @@ memcmp (__const void *__s1, __const void *__s2, size_t __n)
#define __memset_ccn(s, c, n) \
(((n) % 4 == 0) \
- ? __memset_ccn_by4 (s, ((unsigned char) (c)) * 0x01010101, n) \
+ ? __memset_ccn_by4 (s, ((unsigned int) ((unsigned char) (c))) * 0x01010101,\
+ n) \
: (((n) % 2 == 0) \
- ? __memset_ccn_by2 (s, ((unsigned char) (c)) * 0x01010101, n) \
- : __memset_gg (s, c, n)))
+ ? __memset_ccn_by2 (s, \
+ ((unsigned int) ((unsigned char) (c))) * 0x01010101,\
+ n) \
+ : memset (s, c, n)))
-__STRING_INLINE void *__memset_ccn_by4 (void *__s, int __c, size_t __n);
+__STRING_INLINE void *__memset_ccn_by4 (void *__s, unsigned int __c,
+ size_t __n);
__STRING_INLINE void *
-__memset_ccn_by4 (void *__s, int __c, size_t __n)
+__memset_ccn_by4 (void *__s, unsigned int __c, size_t __n)
{
register void *__tmp = __s;
register unsigned long int __d0;
@@ -301,10 +303,11 @@ __memset_ccn_by4 (void *__s, int __c, size_t __n)
return __s;
}
-__STRING_INLINE void *__memset_ccn_by2 (void *__s, int __c, size_t __n);
+__STRING_INLINE void *__memset_ccn_by2 (void *__s, unsigned int __c,
+ size_t __n);
__STRING_INLINE void *
-__memset_ccn_by2 (void *__s, int __c, size_t __n)
+__memset_ccn_by2 (void *__s, unsigned int __c, size_t __n)
{
register unsigned long int __d0, __d1;
register void *__tmp = __s;
@@ -335,7 +338,7 @@ __memset_ccn_by2 (void *__s, int __c, size_t __n)
? __memset_gcn_by4 (s, c, n) \
: (((n) % 2 == 0) \
? __memset_gcn_by2 (s, c, n) \
- : __memset_gg (s, c, n)))
+ : memset (s, c, n)))
__STRING_INLINE void *__memset_gcn_by4 (void *__s, int __c, size_t __n);
@@ -384,27 +387,6 @@ __memset_gcn_by2 (void *__s, int __c, size_t __n)
return __s;
}
-__STRING_INLINE void *__memset_gg (void *__s, int __c, size_t __n);
-
-__STRING_INLINE void *
-__memset_gg (void *__s, int __c, size_t __n)
-{
- register unsigned long int __d0, __d1;
- register void *__tmp = __s;
- __asm__ __volatile__
- ("cld\n\t"
- "movb %%al,%%ah\n\t"
- "shrl $1,%%ecx\n\t"
- "rep; stosw\n\t"
- "jnc 1f\n\t"
- "movb %%al,(%%edi)\n"
- "1:"
- : "=&c" (__d0), "=&D" (__d1)
- : "0" (__n), "1" (__tmp), "a" (__c)
- : "memory", "cc");
- return __s;
-}
-
/* Search N bytes of S for C. */
#define _HAVE_STRING_ARCH_memchr 1