Fix bswap with MSVC compiler
Hi,
Quick compilation fix for MSVC. __builtin_bswap is for clang/GCC and byteswap is for MSVC.
Cheers, -Yohann
Wouldn't this break clang builds on win32?
https://clang.llvm.org/docs/UsersManual.html#microsoft-extensions
@yellows111 Because of _MSC_VER it will only apply for MSVC.
About clang on windows __builtin_bswap16 is supported: https://clang.llvm.org/docs/LanguageExtensions.html#id54
Duplicate of a fix I added in #35
In fact both of us may learn from the IDAXEX implementation which should work on Windows, MacOS, and Linux.
Because of
_MSC_VERit will only apply for MSVC. About clang on windows__builtin_bswap16is supported: https://clang.llvm.org/docs/LanguageExtensions.html#id54
I do not see _byteswap in that list, which is what I'm concerned about.
I'm concerned due to seeing the following: "This is the default for Windows targets.", and "For compatibility with existing code that compiles with MSVC, clang defines the _MSC_VER and _MSC_FULL_VER macros."
Can someone verify that this change doesn't cause builds using clang-cl to fail?
@yellows111 I made sure to check for __clang__ first in #35, and it still builds correctly with Clang. I need someone to test the opposite with MSVC.
Clang should not be defining macros made for other compilers though. That's kinda concerning, considering there are very few ways to check the active compiler.
Is this needed? I already discourage people from using MSVC, and XenonRecomp's output uses many clang/GCC intrinsics that don't work on MSVC anyway.
Is this needed? I already discourage people from using MSVC, and XenonRecomp's output uses many clang/GCC intrinsics that don't work on MSVC anyway.
Maybe just don't do that? Seems like a bad idea to me. idk...
MSVC has horrendous code generation/optimization. It shouldn't be used for the output of a project like this.