Commit | Line | Data |
---|---|---|
3719602c PC |
1 | #ifdef _MSC_VER |
2 | #include <cruntime.h> | |
3 | #endif | |
4 | #include <stdio.h> | |
5 | #include <string.h> | |
6 | ||
7 | void *memset(void *dst, int val, size_t count) | |
8 | { | |
9 | void *start = dst; | |
10 | ||
11 | #if defined(_M_IA64) || defined (_M_AMD64) || defined(_M_ALPHA) || defined (_M_PPC) | |
12 | extern void RtlFillMemory(void *, size_t count, char); | |
13 | ||
14 | RtlFillMemory(dst, count, (char)val); | |
15 | #else | |
16 | while (count--) | |
17 | { | |
18 | *(char*)dst = (char)val; | |
19 | dst = (char*)dst + 1; | |
20 | } | |
21 | #endif | |
22 | ||
23 | return start; | |
24 | } | |
25 | ||
26 | void *memcpy(void *dst, const void *src, size_t len) | |
27 | { | |
28 | size_t i; | |
29 | ||
30 | for (i = 0; i < len; i++) | |
31 | ((unsigned char *)dst)[i] = ((unsigned char *)src)[i]; | |
32 | ||
33 | return dst; | |
34 | } |