Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use builtin_clz for clang on windows #3939

Merged
merged 1 commit into from
Apr 28, 2024

Conversation

OetkenPurveyorOfCode
Copy link
Contributor

Clang on windows defines both _MSC_VER and clang for compatibility reason. The logic in sinfl.h selects the MSVC buitlin which clang only understands in clang-cl compatibility mode. If compiled with regular clang _MSC_VER is defined but the _BitScanReverse builtin is not recognised. This leads to the following warning during compilation:

In file included from ../raylib/src\rcore.c:141:
../raylib/src/external/sinfl.h:175:19: warning: incompatible pointer types passing 'unsigned int *' to parameter of type
      'unsigned long *' [-Wincompatible-pointer-types]
  175 |   _BitScanReverse(&n, n);
      |                   ^~

This PR fixes that by selecting the __builtin_clz builtin if clang is defined.

@raysan5 raysan5 merged commit f787219 into raysan5:master Apr 28, 2024
@raysan5
Copy link
Owner

raysan5 commented Apr 28, 2024

@OetkenPurveyorOfCode Thanks for the review! Please note that sinfl.h is actually an external library, it should probably also be fixed on base repo: https://github.com/vurtun/lib/blob/master/sinfl.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants