fix: Endian.ipp error on Windows for C++20 build#1334
Open
iantab wants to merge 1 commit intoSiv3D:v6_developfrom
Open
fix: Endian.ipp error on Windows for C++20 build#1334iantab wants to merge 1 commit intoSiv3D:v6_developfrom
iantab wants to merge 1 commit intoSiv3D:v6_developfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
I ran into a build error using Siv3D headers under
/std:c++20on MSVC.Endian.ipp(Windows branch) usesstd::byteswap, which is a C++23 library feature rather than C++20, so compilation fails with:error C2039: 'byteswap': is not a member of 'std'It builds fine under
/std:c++latest(which is whatSiv3D.vcxprojuses), so this only shows up when consuming the headers from a C++20 project.Fix
Swap the three Windows-branch calls for the MSVC intrinsics
_byteswap_ushort/_byteswap_ulong/_byteswap_uint64from<cstdlib>. These are available regardless of/std:mode, so the Windows branch compiles cleanly under both/std:c++20and/std:c++latest.The macOS branch, the generic fallback, and the public
Endian.hppAPI are untouched.