summaryrefslogtreecommitdiff
path: root/src/stem/lib
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2010-02-05 19:37:47 +0100
committerAlexis211 <alexis211@gmail.com>2010-02-05 19:37:47 +0100
commitc0018a3607947922a51597df12fd2a6528af2fa2 (patch)
tree031225d03933dfe4e1f2ace1d91f5e98bcfd94d4 /src/stem/lib
parent674014901a1e90ce1587a7709fe9bf5893b0e36e (diff)
downloadTCE-c0018a3607947922a51597df12fd2a6528af2fa2.tar.gz
TCE-c0018a3607947922a51597df12fd2a6528af2fa2.zip
More work on tasking, paging, syscalls, stuff.
Diffstat (limited to 'src/stem/lib')
-rw-r--r--src/stem/lib/stdlib.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/stem/lib/stdlib.c b/src/stem/lib/stdlib.c
index 904126e..f4ebd33 100644
--- a/src/stem/lib/stdlib.c
+++ b/src/stem/lib/stdlib.c
@@ -1,12 +1,19 @@
#include "stdlib.h"
-void *memcpy(void *dest, const void *src, int count) {
- int i;
- uint8_t *d = (uint8_t*)dest, *s = (uint8_t*)src;
- for (i = 0; i < count; i++) {
+void *memcpy(void *vd, const void *vs, int count) {
+ uint8_t *dest = vd, *src = vs;
+ uint32_t f = count % 4, n = count / 4, i;
+ const uint32_t* s = (uint32_t*)src;
+ uint32_t* d = (uint32_t*)dest;
+ for (i = 0; i < n; i++) {
d[i] = s[i];
}
- return dest;
+ if (f != 0) {
+ for (i = count - f; i < count; i++) {
+ dest[i] = src[i];
+ }
+ }
+ return vd;
}
uint8_t *memset(uint8_t *dest, uint8_t val, int count) {
@@ -14,6 +21,7 @@ uint8_t *memset(uint8_t *dest, uint8_t val, int count) {
for (i = 0; i < count; i++) {
dest[i] = val;
}
+ return dest;
}
uint16_t *memsetw(uint16_t *dest, uint16_t val, int count) {