Skip to content

Commit

Permalink
Saying hello
Browse files Browse the repository at this point in the history
  • Loading branch information
boazsegev committed Feb 22, 2024
1 parent 9a13ce8 commit 74b013e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
15 changes: 14 additions & 1 deletion fio-stl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,19 @@ FIO___MAKE_MEMCPY_FIXED(32)
FIO___MAKE_MEMCPY_FIXED(64)
/** Copies 128 bytes from `src` (`s`) to `dest` (`d`). */
FIO___MAKE_MEMCPY_FIXED(128)

#if !(__has_builtin(__builtin_memcpy))
#undef FIO___MAKE_MEMCPY_FIXED
#define FIO___MAKE_MEMCPY_FIXED(bytes) \
FIO_SFUNC void *fio_memcpy##bytes(void *restrict d, \
const void *restrict s) { \
void *const r = (char *)d + bytes; \
for (size_t i = 0; i < (bytes); i += 128) /* compiler, please vectorize */ \
fio_memcpy128(((char *)d)[i], ((const char *)s)[i]); \
return r; \
}
#endif /* __has_builtin(__builtin_memcpy) */

/** Copies 256 bytes from `src` (`s`) to `dest` (`d`). */
FIO___MAKE_MEMCPY_FIXED(256)
/** Copies 512 bytes from `src` (`s`) to `dest` (`d`). */
Expand Down Expand Up @@ -1184,7 +1197,7 @@ FIO_SFUNC void *fio___memcpy_unsafe_x(void *restrict d_,
}

#define FIO___MEMCPYX_MAKER(lim, fn) \
FIO_SFUNC void *fio_memcpy##lim##x(void *restrict d, \
FIO_IFUNC void *fio_memcpy##lim##x(void *restrict d, \
const void *restrict s, \
size_t l) { \
return fn(d, s, (l & lim)); \
Expand Down
15 changes: 14 additions & 1 deletion fio-stl/000 core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,19 @@ FIO___MAKE_MEMCPY_FIXED(32)
FIO___MAKE_MEMCPY_FIXED(64)
/** Copies 128 bytes from `src` (`s`) to `dest` (`d`). */
FIO___MAKE_MEMCPY_FIXED(128)

#if !(__has_builtin(__builtin_memcpy))
#undef FIO___MAKE_MEMCPY_FIXED
#define FIO___MAKE_MEMCPY_FIXED(bytes) \
FIO_SFUNC void *fio_memcpy##bytes(void *restrict d, \
const void *restrict s) { \
void *const r = (char *)d + bytes; \
for (size_t i = 0; i < (bytes); i += 128) /* compiler, please vectorize */ \
fio_memcpy128(((char *)d)[i], ((const char *)s)[i]); \
return r; \
}
#endif /* __has_builtin(__builtin_memcpy) */

/** Copies 256 bytes from `src` (`s`) to `dest` (`d`). */
FIO___MAKE_MEMCPY_FIXED(256)
/** Copies 512 bytes from `src` (`s`) to `dest` (`d`). */
Expand Down Expand Up @@ -1147,7 +1160,7 @@ FIO_SFUNC void *fio___memcpy_unsafe_x(void *restrict d_,
}

#define FIO___MEMCPYX_MAKER(lim, fn) \
FIO_SFUNC void *fio_memcpy##lim##x(void *restrict d, \
FIO_IFUNC void *fio_memcpy##lim##x(void *restrict d, \
const void *restrict s, \
size_t l) { \
return fn(d, s, (l & lim)); \
Expand Down

0 comments on commit 74b013e

Please sign in to comment.