Skip to content

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