2020-01-17 02:54:38 +08:00
|
|
|
#include <stddef.h>
|
|
|
|
extern void *memcpy(void *dest, void const *from, size_t n);
|
|
|
|
|
|
|
|
#ifdef WITH_DECL
|
2021-10-03 05:17:30 +08:00
|
|
|
inline __attribute__((always_inline)) __attribute__((gnu_inline)) void *memcpy(void *dest, void const *from, size_t n) {
|
2020-01-17 02:54:38 +08:00
|
|
|
char const *ifrom = from;
|
|
|
|
char *idest = dest;
|
|
|
|
while (n--)
|
|
|
|
*idest++ = *ifrom++;
|
|
|
|
return dest;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef WITH_SELF_REFERENCE_DECL
|
2021-10-03 05:17:30 +08:00
|
|
|
inline __attribute__((always_inline)) __attribute__((gnu_inline)) void *memcpy(void *dest, void const *from, size_t n) {
|
2020-01-17 02:54:38 +08:00
|
|
|
if (n != 0)
|
|
|
|
memcpy(dest, from, n);
|
|
|
|
return dest;
|
|
|
|
}
|
|
|
|
#endif
|