Subversion Repositories HelenOS-historic

Rev

Rev 1472 | Rev 1538 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1472 Rev 1485
Line 40... Line 40...
40
    while (n--)
40
    while (n--)
41
        *(os++) = c;
41
        *(os++) = c;
42
    return s;
42
    return s;
43
}
43
}
44
 
44
 
45
void * memcpy(void *dest, void *src, size_t n)
45
void * memcpy(void *dst, const void *src, size_t n)
46
{
46
{
47
    char *os = src;
47
    int i, j;
-
 
48
 
-
 
49
    for (i = 0; i < n/sizeof(unsigned long); i++)
-
 
50
        ((unsigned long *) dst)[i] = ((unsigned long *) src)[i];
-
 
51
       
-
 
52
    for (j = 0; j < n%sizeof(unsigned long); j++)
-
 
53
        ((unsigned char *)(((unsigned long *) dst) + i))[j] = ((unsigned char *)(((unsigned long *) src) + i))[j];
-
 
54
       
48
    char *odst = dest;
55
    return (char *)src;
-
 
56
}
-
 
57
 
-
 
58
void * memmove(void *dst, const void *src, size_t n)
-
 
59
{
49
    while (n--)
60
    int i, j;
-
 
61
   
50
        *(odst++) = *(os++);
62
    if (src > dst)
-
 
63
        return memcpy(dst, src, n);
-
 
64
 
-
 
65
    for (j = (n%sizeof(unsigned long))-1; j >= 0; j--)
-
 
66
        ((unsigned char *)(((unsigned long *) dst) + i))[j] = ((unsigned char *)(((unsigned long *) src) + i))[j];
-
 
67
 
-
 
68
    for (i = n/sizeof(unsigned long)-1; i >=0 ; i--)
-
 
69
        ((unsigned long *) dst)[i] = ((unsigned long *) src)[i];
-
 
70
       
51
    return dest;
71
    return (char *)src;
52
}
72
}
53
 
73
 
-
 
74
 
54
/** Count the number of characters in the string, not including terminating 0.
75
/** Count the number of characters in the string, not including terminating 0.
55
 * @param str string
76
 * @param str string
56
 * @return number of characters in string.
77
 * @return number of characters in string.
57
 */
78
 */
58
size_t strlen(const char *str)
79
size_t strlen(const char *str)