This is the mail archive of the
mailing list for the GCC project.
Patch committed: Make exact_log2 and floor_log2 static inline
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 16 Jun 2009 09:58:02 -0700
- Subject: Patch committed: Make exact_log2 and floor_log2 static inline
The functions exact_log2 and floor_log2 are defined in toplev.h and
toplev.c as GNU89 extern inline functions. This does not work right
with C++ or with C99. For C99 we could use the gnu_inline attribute,
but there is really no advantage to doing so. This patch changes
floor_log2 and exact_log2 to be static inline. The definitions in
toplev.c are only provided if the static inline functions are not
defined, which is to say when compiling with a non-gcc compiler or
with gcc pre 3.4. This simplifies the code overall.
Bootstrapped and tested on x86_64-unknown-linux-gnu. Committed.
2009-06-16 Ian Lance Taylor <email@example.com>
* toplev.h (floor_log2): If GCC_VERSION >= 3004, declare as static
inline, not extern inline.
* toplev.c (floor_log2): Only define if GCC_VERSION < 3004. Don't
(exact_log2): Likewise, but don't test CTZ_HWI.
<#part type="text/x-patch" filename="~/foo.patch" disposition=inline description="Simplify exact_log2 and floor_log2">