blob: 608a4ecc8dc3bc4f7a105995a67d236463a9ed53 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
void *memcpy8(void * dst, void const * src, size_t len) {
int i;
for (i = 0; i < len; i++) ((char*)dst)[i] = ((char*)src)[i];
return dst;
}
void *memcpy32(void * dst, void const * src, size_t len) {
uint32_t * plDst = (uint32_t *) dst;
uint32_t const * plSrc = (uint32_t const *) src;
while (len >= 4) {
*plDst++ = *plSrc++;
len -= 4;
}
char * pcDst = (char *) plDst;
char const * pcSrc = (char const *) plSrc;
while (len--) {
*pcDst++ = *pcSrc++;
}
return (dst);
}
int get_page_mask() {
int pagesize,pagemask,temp;
pagesize = getpagesize();
for( pagemask=0, temp = pagesize; temp != 1; ) {
temp = (temp >> 1);
pagemask = (pagemask << 1)+1;
}
return pagemask;
}
|