[llvm] r238111 - Remove log2 dependency when building against Android API-9 SDK

Vince Harron vince at nethacker.com
Sun May 24 06:24:31 PDT 2015


Author: vharron
Date: Sun May 24 08:24:31 2015
New Revision: 238111

URL: http://llvm.org/viewvc/llvm-project?rev=238111&view=rev
Log:
Remove log2 dependency when building against Android API-9 SDK

Android's API-9 SDK is missing log2 builtins. A previous commit added
support for building against this API revision but this requires log2l
to be present.  (And it doesn't seem to be defined, despite being in
the headers.)

Author: pasaulais (Pierre-Andre Saulais)

Differential Revision: http://reviews.llvm.org/D9884


Modified:
    llvm/trunk/include/llvm/Support/MathExtras.h

Modified: llvm/trunk/include/llvm/Support/MathExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MathExtras.h?rev=238111&r1=238110&r2=238111&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/MathExtras.h (original)
+++ llvm/trunk/include/llvm/Support/MathExtras.h Sun May 24 08:24:31 2015
@@ -456,7 +456,7 @@ inline unsigned countPopulation(T Value)
 /// Log2 - This function returns the log base 2 of the specified value
 inline double Log2(double Value) {
 #if defined(__ANDROID_API__) && __ANDROID_API__ < 18
-  return (double)__builtin_log2l(Value);
+  return __builtin_log(Value) / __builtin_log(2.0);
 #else
   return log2(Value);
 #endif





More information about the llvm-commits mailing list