summaryrefslogtreecommitdiff
path: root/ldso/include/dl-string.h
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2004-08-10 15:25:35 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2004-08-10 15:25:35 +0000
commit259fd0364d0ee131e1df6c46a0ed7a032c5e73a7 (patch)
tree1a0a9289d716eb3fb6ffd5423174a4759a230dfb /ldso/include/dl-string.h
parenta53036dba53fb4358186c5293341df5ede516026 (diff)
Optimze _dl_memset() for PowerPC.
Other arches may also benefit from this iff it can do unaligned stores.
Diffstat (limited to 'ldso/include/dl-string.h')
-rw-r--r--ldso/include/dl-string.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/ldso/include/dl-string.h b/ldso/include/dl-string.h
index 3e14971e6..c428634d2 100644
--- a/ldso/include/dl-string.h
+++ b/ldso/include/dl-string.h
@@ -158,6 +158,33 @@ static inline int _dl_memcmp(const void * s1,const void * s2,size_t len)
return 0;
}
+#if defined(powerpc)
+/* Will generate smaller and faster code due to loop unrolling.*/
+static inline void *_dl_memset(void *to, int c, size_t n)
+{
+ unsigned long chunks;
+ unsigned long *tmp_to;
+ unsigned char *tmp_char;
+
+ chunks = n / 4;
+ tmp_to = to + n;
+ c = c << 8 | c;
+ c = c << 16 | c;
+ if (!chunks)
+ goto lessthan4;
+ do {
+ *--tmp_to = c;
+ } while (--chunks);
+ lessthan4:
+ n = n % 4;
+ if (!n ) return to;
+ tmp_char = (unsigned char *)tmp_to;
+ do {
+ *--tmp_char = c;
+ } while (--n);
+ return to;
+}
+#else
static inline void * _dl_memset(void * str,int c,size_t len)
{
register char *a = str;
@@ -167,6 +194,7 @@ static inline void * _dl_memset(void * str,int c,size_t len)
return str;
}
+#endif
static inline char *_dl_get_last_path_component(char *path)
{