aboutsummaryrefslogtreecommitdiff
path: root/string/bits
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-04-30 17:44:43 +0000
committerUlrich Drepper <drepper@redhat.com>1999-04-30 17:44:43 +0000
commit23f5f62d4b31c442f5bd49c64982e4e40935bc33 (patch)
tree7a69dac50ade15bee1caa31dea53103c05c5a08f /string/bits
parentc5883607f5b138b31176de7b2664f0d217b2dbf2 (diff)
downloadglibc-23f5f62d4b31c442f5bd49c64982e4e40935bc33.tar
glibc-23f5f62d4b31c442f5bd49c64982e4e40935bc33.tar.gz
glibc-23f5f62d4b31c442f5bd49c64982e4e40935bc33.tar.bz2
glibc-23f5f62d4b31c442f5bd49c64982e4e40935bc33.zip
Update.
1999-04-30 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * string/bits/string2.h (memset): Revert to previous version if unaligned writes are not available. 1999-04-30 Ulrich Drepper <drepper@cygnus.com> * sysdeps/i386/i486/bits/string.h (__memset_gc): Help generating better code in presence of the asm. 1999-04-30 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * stdlib/fmtmsg.c (keywords): Increase array size for faster indexing. * locale/localeinfo.h (_nl_category_names): Increase array element size for faster indexing. * locale/setlocale.c (_nl_category_names): Adjusted. 1999-04-30 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * iconv/gconv_conf.c (add_alias): Remove wrong cast.
Diffstat (limited to 'string/bits')
-rw-r--r--string/bits/string2.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/string/bits/string2.h b/string/bits/string2.h
index 3f7784ed38..aedadf439c 100644
--- a/string/bits/string2.h
+++ b/string/bits/string2.h
@@ -93,7 +93,8 @@ __STRING2_COPY_TYPE (8);
/* Set N bytes of S to C. */
#ifndef _HAVE_STRING_ARCH_memset
-# define memset(s, c, n) \
+# if _STRING_ARCH_unaligned
+# define memset(s, c, n) \
(__extension__ (__builtin_constant_p (n) && (n) <= 16 \
? ((n) == 1 \
? __memset_1 (s, c) \
@@ -102,10 +103,10 @@ __STRING2_COPY_TYPE (8);
? ({ void *__s = (s); __bzero (__s, n); __s; }) \
: memset (s, c, n))))
-#define __memset_1(s, c) ({ void *__s = (s); \
+# define __memset_1(s, c) ({ void *__s = (s); \
*((__uint8_t *) __s) = (__uint8_t) c; __s; })
-#define __memset_gc(s, c, n) \
+# define __memset_gc(s, c, n) \
({ void *__s = (s); \
__uint32_t *__ts = (__uint32_t *) __s; \
__uint8_t __c = (__uint8_t) (c); \
@@ -157,10 +158,17 @@ __STRING2_COPY_TYPE (8);
} \
\
__s; })
+# else
+# define memset(s, c, n) \
+ (__extension__ (__builtin_constant_p (c) && (c) == '\0' \
+ ? ({ void *__s = (s); __bzero (__s, n); __s; }) \
+ : memset (s, c, n)))
+# endif
+
/* GCC optimizes memset(s, 0, n) but not bzero(s, n). */
-#if defined __GNUC__ && __GNUC__ >= 2
-# define __bzero(s, n) __builtin_memset(s, '\0', n)
-#endif
+# if defined __GNUC__ && __GNUC__ >= 2
+# define __bzero(s, n) __builtin_memset(s, '\0', n)
+# endif
#endif