Etheory patch gcc narrowing fix + MSVC support #3
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.
Fixes issue for more strict compilation in GCC (also works in Clang).
Tested in a VFX production environment on Linux.
The previous definition of v4sil was trying to cast to a 64bit type, not not exactly matching the expected underlying type (long long).
Under c++11, this fails to compile with a narrowing warning.
i.e. in gcc when using the flags "-std=c++11 -Wnarrowing"
By casting to a "long long" instead of "unsigned long long" above, we match the type of the underlying definition, and also the v2dil cast then work correctly to widen the 2 64bit type to the expected final 128bit type.
@pmineiro @romeric
P.S. to verify go to godbolt, and paste the following:
Then compile with a gcc target, with the following flags:
-O3 -ffast-math -std=c++11 -Wnarrowing
Note that without this change, it won't compile.