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

Pierre-Andre Saulais pierre-andre at codeplay.com
Thu May 21 03:19:30 PDT 2015


That's true, this commit would require manually setting HAVE_LOG2 to zero on Android. Since HAVE_LOG2 and other macros have been dropped (r231679) I was trying not to pull the autoconf/CMake changes back. I see two solutions:

1. Use 'log(n) / log(2)' instead of log2l on Android, don't use HAVE_LOG2 at all.
2. Reintroduce HAVE_LOG2 through CMake and autoconf. Remove the Android-specific changes added by Vince.

I am uploading a new patch that does 1) since that's the least intrusive change.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9884

Files:
  include/llvm/Support/MathExtras.h

Index: include/llvm/Support/MathExtras.h
===================================================================
--- include/llvm/Support/MathExtras.h
+++ include/llvm/Support/MathExtras.h
@@ -456,7 +456,7 @@
 /// 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

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9884.26211.patch
Type: text/x-patch
Size: 500 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150521/787d3130/attachment.bin>


More information about the llvm-commits mailing list