Add missing files

This commit is contained in:
Alexey Milovidov 2021-03-03 02:33:17 +03:00
parent d1b3258ae7
commit aecdadd02e
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,2 @@
add_executable(memcpy_test memcpy_test.cpp)
target_link_libraries(memcpy_test common memcpy)

View File

@ -0,0 +1,26 @@
#include <string.h>
#include <iostream>
#include <memcpy.h>
__attribute__((__noinline__)) void memcpy_noinline(void * __restrict dst, const void * __restrict src, size_t size)
{
memcpy(dst, src, size);
}
int main(int, char **)
{
constexpr size_t buf_size = 100;
char buf[buf_size]{};
memcpy_noinline(buf, "abc", 3);
size_t bytes_to_copy = 3;
while (bytes_to_copy * 2 < buf_size)
{
memcpy_noinline(&buf[bytes_to_copy], buf, bytes_to_copy);
bytes_to_copy *= 2;
}
std::cerr << buf << "\n";
return 0;
}