From: Katy Feng Date: Tue, 21 Nov 2023 20:17:25 +0000 (-0800) Subject: Change to common header file not applicable to open-vm-tools. X-Git-Tag: stable-12.4.0~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bf9de66e43222f50d1280f7181bc542b059d02f;p=thirdparty%2Fopen-vm-tools.git Change to common header file not applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/include/vm_basic_asm.h b/open-vm-tools/lib/include/vm_basic_asm.h index 9d98b869c..c259c53cf 100644 --- a/open-vm-tools/lib/include/vm_basic_asm.h +++ b/open-vm-tools/lib/include/vm_basic_asm.h @@ -678,11 +678,20 @@ Bswap32(uint32 v) // IN static INLINE uint64 Bswap64(uint64 v) // IN { -#if defined(VM_ARM_64) && !defined(_MSC_VER) +#if defined _MSC_VER + return _byteswap_uint64(v); +#elif defined __GNUC__ + +/* TODO: Return __builtin_bswap64(v) if gcc-arm64 is verified to use "rev". */ +#if defined VM_ARM_64 __asm__("rev %0, %0" : "+r"(v)); return v; #else - return ((uint64)Bswap((uint32)v) << 32) | Bswap((uint32)(v >> 32)); + return __builtin_bswap64(v); +#endif + +#else + return ((uint64)Bswap32((uint32)v) << 32) | Bswap32((uint32)(v >> 32)); #endif }