Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Unam3dd committed Jun 2, 2024
1 parent 79afd37 commit 32f4ec3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions inc/eth-memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#ifdef NO_STATIC
void *_eth_memcpy_naive(void *restrict dst, const void *restrict src, size_t size);
void *_eth_memcpy_erms(void *restrict dst, const void *restrict src, size_t size);
#endif

void *eth_memcpy(void *restrict dst, const void *restrict src, size_t size);
Expand Down
4 changes: 2 additions & 2 deletions inc/eth-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//
//////////////////////////////////////

#ifndef ETH_NULL
#define ETH_NULL (void*)0
#ifndef NULL
#define NULL (void*)0
#endif

///////////////////////////////////////
Expand Down
16 changes: 12 additions & 4 deletions src/memory/memcpy/memcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//////////////////////////////////////

STATIC void *_eth_memcpy_naive (void *restrict dst, const void *restrict src, size_t size)
STATIC void * _eth_memcpy_naive(void *restrict dst, const void *restrict src, size_t size)
{
if (!dst || !src || !size)
return (dst);
Expand All @@ -18,14 +18,22 @@ STATIC void *_eth_memcpy_naive (void *restrict dst, const void *restrict src, si
return (dst);
}

STATIC void* _eth_memcpy_erms(void *restrict dst, const void *restrict src, size_t size)
{
if (!dst || !src || !size) return (dst);

return (dst);
}

#if defined(__linux__)

void *(*_eth_memcpy_ifunc (void)) (void *restrict, const void *restrict, size_t)
static void *(*_eth_memcpy_ifunc(void)) (void *restrict, const void *restrict, size_t)
{
return (_eth_memcpy_naive);
(void)_eth_memcpy_erms(NULL, NULL, 0);
return (_eth_memcpy_naive);
}

void *eth_memcpy (void *restrict dst, const void *restrict src, size_t size) __attribute__((ifunc ("_eth_memcpy_ifunc")));
void *eth_memcpy(void *restrict dst, const void *restrict src, size_t size) __attribute__((ifunc ("_eth_memcpy_ifunc")));


#endif

0 comments on commit 32f4ec3

Please sign in to comment.