From 4d98faa5155e5474161aa1757a0721892ac73a05 Mon Sep 17 00:00:00 2001 From: Jon Kunkee Date: Mon, 4 Feb 2019 09:57:34 -0800 Subject: [PATCH] Only use __movsb on architectures that support it (#5147) With the introduction of Windows 10 on ARM (ARM64), code that assumes that Windows targets are always x86 or x86_64 targets needs to be updated. The hot function ReadUInt64 has been optimized in MSVC builds using the compiler intrinsic __movsb. Since this does not exist on ARM64 Windows, this change uses the pure C++ path that other platforms use instead. --- include/flatbuffers/flexbuffers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/flatbuffers/flexbuffers.h b/include/flatbuffers/flexbuffers.h index 51cae532d..7cba5b75b 100644 --- a/include/flatbuffers/flexbuffers.h +++ b/include/flatbuffers/flexbuffers.h @@ -153,7 +153,7 @@ inline uint64_t ReadUInt64(const uint8_t *data, uint8_t byte_width) { // constant, which here it isn't. Test if memcpy is still faster than // the conditionals in ReadSizedScalar. Can also use inline asm. // clang-format off - #ifdef _MSC_VER + #if defined(_MSC_VER) && (defined(_M_X64) || defined _M_IX86) uint64_t u = 0; __movsb(reinterpret_cast(&u), reinterpret_cast(data), byte_width);