We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3791 - SDL_bits.h: __builtin_clz is supported in gcc >= 3.4
Summary: SDL_bits.h: __builtin_clz is supported in gcc >= 3.4
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-31 17:19 UTC by Ozkan Sezer
Modified: 2017-08-31 22:17 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ozkan Sezer 2017-08-31 17:19:03 UTC
__builtin_clz is supported in gcc >= 3.4. The following patchlet adjusts
SDL_bits.h for it.

diff --git a/include/SDL_bits.h b/include/SDL_bits.h
--- a/include/SDL_bits.h
+++ b/include/SDL_bits.h
@@ -60,7 +60,7 @@
 SDL_FORCE_INLINE int
 SDL_MostSignificantBitIndex32(Uint32 x)
 {
-#if defined(__GNUC__) && __GNUC__ >= 4
+#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
     /* Count Leading Zeroes builtin in GCC.
      * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
      */
Comment 1 Sam Lantinga 2017-08-31 22:17:32 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/b5e2b88d5193