This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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  <>

	* toplev.h (floor_log2): If GCC_VERSION >= 3004, declare as static
	inline, not extern inline.
	(exact_log2): Likewise.
	* toplev.c (floor_log2): Only define if GCC_VERSION < 3004. Don't
	test CLZ_HWI.
	(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">

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]