1 #include <string>
2
memcpy_noinline(void * dst,void * src,size_t size)3 void __attribute__((noinline)) memcpy_noinline(void *dst, void *src, size_t size)
4 {
5 memcpy(dst,src,size);
6 }
7
memset_noinline(void * dst,int value,size_t size)8 void __attribute__((noinline)) memset_noinline(void *dst, int value, size_t size)
9 {
10 memset(dst, value, size);
11 }
12
sum(volatile void * src,size_t size)13 uint64_t __attribute__((noinline)) sum(volatile void *src, size_t size)
14 {
15 uint64_t *src_ptr = (uint64_t*)src;
16 uint64_t sum = 0;
17 size_t len = size / sizeof(uint64_t);
18 for (size_t i = 0; i < len; i+=1)
19 sum += src_ptr[i];
20 return sum;
21 }
22