summaryrefslogtreecommitdiffstats
path: root/include/asm-alpha/string.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-05-07 02:55:41 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-05-07 02:55:41 +0000
commitdcec8a13bf565e47942a1751a9cec21bec5648fe (patch)
tree548b69625b18cc2e88c3e68d0923be546c9ebb03 /include/asm-alpha/string.h
parent2e0f55e79c49509b7ff70ff1a10e1e9e90a3dfd4 (diff)
o Merge with Linux 2.1.99.
o Fix ancient bug in the ELF loader making ldd crash. o Fix ancient bug in the keyboard code for SGI, SNI and Jazz.
Diffstat (limited to 'include/asm-alpha/string.h')
-rw-r--r--include/asm-alpha/string.h43
1 files changed, 27 insertions, 16 deletions
diff --git a/include/asm-alpha/string.h b/include/asm-alpha/string.h
index 6ef1f4120..4b83c8291 100644
--- a/include/asm-alpha/string.h
+++ b/include/asm-alpha/string.h
@@ -3,29 +3,40 @@
#ifdef __KERNEL__
-extern void * __constant_c_memset(void *, unsigned long, long);
-extern void * __memset(void *, char, size_t);
-
/*
- * Ugh. Gcc uses "bcopy()" internally for structure assignments.
+ * GCC of any recent vintage doesn't do stupid things with bcopy. Of
+ * EGCS-devel vintage, it knows all about expanding memcpy inline.
+ * For things other than EGCS-devel but still recent, GCC will expand
+ * __builtin_memcpy as a simple call to memcpy.
+ *
+ * Similarly for a memset with data = 0.
*/
-#define __HAVE_ARCH_BCOPY
-/*
- * Define "memcpy()" to something else, otherwise gcc will
- * corrupt that too into a "bcopy". Also, some day we might
- * want to do a separate inlined constant-size memcpy (for 8
- * and 16 byte user<->kernel structure copying).
- */
#define __HAVE_ARCH_MEMCPY
+/* For backward compatibility with modules. Unused otherwise. */
extern void * __memcpy(void *, const void *, size_t);
-#define memcpy __memcpy
+
+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 8
+#define memcpy __builtin_memcpy
+#endif
#define __HAVE_ARCH_MEMSET
-#define memset(s, c, count) \
-(__builtin_constant_p(c) ? \
- __constant_c_memset((s),(0x0101010101010101UL*(unsigned char)c),(count)) : \
- __memset((s),(c),(count)))
+extern void * __constant_c_memset(void *, unsigned long, long);
+extern void * __memset(void *, char, size_t);
+
+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 8
+#define memset(s, c, n) \
+(__builtin_constant_p(c) \
+ ? (__builtin_constant_p(n) && (c) == 0 \
+ ? __builtin_memset((s),0,(n)) \
+ : __constant_c_memset((s),0x0101010101010101UL*(unsigned char)(c),(n))) \
+ : __memset((s),(c),(n)))
+#else
+#define memset(s, c, n) \
+(__builtin_constant_p(c) \
+ ? __constant_c_memset((s),0x0101010101010101UL*(unsigned char)(c),(n)) \
+ : __memset((s),(c),(n)))
+#endif
#define __HAVE_ARCH_STRCPY
#define __HAVE_ARCH_STRNCPY