[git commit nptl] sh4: Reorder code in memmove.c
Carmelo Amoroso
carmelo.amoroso at st.com
Fri Oct 9 16:10:50 UTC 2009
commit: http://git.uclibc.org/uClibc/commit/?id=897b7f7d2bfb31cb45cbde6ae2c72f09a5dcbaaf
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/nptl
Remove forward declaration for service routine.
Reorder code and keep hidden_def right after the respective function.
Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com>
---
libc/string/sh/sh4/memmove.c | 62 ++++++++++++++++++++---------------------
1 files changed, 30 insertions(+), 32 deletions(-)
diff --git a/libc/string/sh/sh4/memmove.c b/libc/string/sh/sh4/memmove.c
index 3102039..4d52db2 100644
--- a/libc/string/sh/sh4/memmove.c
+++ b/libc/string/sh/sh4/memmove.c
@@ -9,37 +9,6 @@
#include <string.h>
-static void fpu_optimised_copy_fwd(void *dest, const void *src, size_t len);
-
-void *memmove(void *dest, const void *src, size_t len)
-{
- unsigned long int d = (long int)dest;
- unsigned long int s = (long int)src;
- unsigned long int res;
-
- if (d >= s)
- res = d - s;
- else
- res = s - d;
- /*
- * 1) dest and src are not overlap ==> memcpy (BWD/FDW)
- * 2) dest and src are 100% overlap ==> memcpy (BWD/FDW)
- * 3) left-to-right overlap ==> Copy from the beginning to the end
- * 4) right-to-left overlap ==> Copy from the end to the beginning
- */
-
- if (res == 0) /* 100% overlap */
- memcpy(dest, src, len); /* No overlap */
- else if (res >= len)
- memcpy(dest, src, len);
- else {
- if (d > s) /* right-to-left overlap */
- memcpy(dest, src, len); /* memcpy is BWD */
- else /* cannot use SH4 memcpy for this case */
- fpu_optimised_copy_fwd(dest, src, len);
- }
- return (dest);
-}
#define FPSCR_SR (1 << 20)
#define STORE_FPSCR(x) __asm__ volatile("sts fpscr, %0" : "=r"(x))
@@ -101,7 +70,6 @@ static void fpu_optimised_copy_fwd(void *dest, const void *src, size_t len)
d1 += 2;
len -= 32;
}
-
LOAD_FPSCR(fpscr);
}
s = (char *)s1;
@@ -116,4 +84,34 @@ static void fpu_optimised_copy_fwd(void *dest, const void *src, size_t len)
return;
}
+void *memmove(void *dest, const void *src, size_t len)
+{
+ unsigned long int d = (long int)dest;
+ unsigned long int s = (long int)src;
+ unsigned long int res;
+
+ if (d >= s)
+ res = d - s;
+ else
+ res = s - d;
+ /*
+ * 1) dest and src are not overlap ==> memcpy (BWD/FDW)
+ * 2) dest and src are 100% overlap ==> memcpy (BWD/FDW)
+ * 3) left-to-right overlap ==> Copy from the beginning to the end
+ * 4) right-to-left overlap ==> Copy from the end to the beginning
+ */
+
+ if (res == 0) /* 100% overlap */
+ memcpy(dest, src, len); /* No overlap */
+ else if (res >= len)
+ memcpy(dest, src, len);
+ else {
+ if (d > s) /* right-to-left overlap */
+ memcpy(dest, src, len); /* memcpy is BWD */
+ else /* cannot use SH4 memcpy for this case */
+ fpu_optimised_copy_fwd(dest, src, len);
+ }
+ return (dest);
+}
+
libc_hidden_def(memmove)
--
1.6.3.3
More information about the uClibc-cvs
mailing list