resolve #201 with a platform-selective REP MOVSB implementation

This commit is contained in:
Haneef Mubarak 2020-05-26 16:04:28 -07:00
parent 66048cb6cc
commit 429025634e
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: D725649CEBABE897
8 changed files with 26 additions and 10 deletions

View file

@ -174,6 +174,22 @@ bool _mi_page_is_valid(mi_page_t* page);
#define EOVERFLOW (75)
#endif
// ------------------------------------------------------
// Fast `memcpy()` on x86(_64) platforms unavailable,
// use REP MOVSB
// ------------------------------------------------------
#if defined(_M_IX86) || defined(_M_X64)
#include <intrin.h>
#define _mi_memcpy _mi_memcpy_rep_movsb
static inline void _mi_memcpy_rep_movsb (void *d, const void *s, size_t n) {
__movsb(d, s, n);
return;
}
#else
#define _mi_memcpy memcpy
#endif
/* -----------------------------------------------------------
Inlined definitions