summaryrefslogtreecommitdiff
path: root/src/utilities/android.hpp
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-09-26 21:20:01 +0200
committerCedric Nugteren <web@cedricnugteren.nl>2017-09-26 21:20:01 +0200
commit00b57714779e207b156fca508cc10e4d569405b6 (patch)
tree01d847fd170a33dee467a1b3990eadf999151fca /src/utilities/android.hpp
parent21af690472033dffcd20ee09f815913b84684a78 (diff)
Added Android header for compilation with gnustl STL
Diffstat (limited to 'src/utilities/android.hpp')
-rw-r--r--src/utilities/android.hpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/utilities/android.hpp b/src/utilities/android.hpp
new file mode 100644
index 00000000..c14f92f3
--- /dev/null
+++ b/src/utilities/android.hpp
@@ -0,0 +1,46 @@
+
+// =================================================================================================
+// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
+// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max-
+// width of 100 characters per line.
+//
+// Author(s):
+// Cedric Nugteren <www.cedricnugteren.nl>
+//
+// This file provides macro's and definitions to make compilation work for Android.
+//
+// =================================================================================================
+
+#ifndef CLBLAST_ANDROID_HPP_
+#define CLBLAST_ANDROID_HPP_
+
+// =================================================================================================
+
+#include <cstdlib>
+#include <string>
+#include <sstream>
+
+namespace std {
+
+// No support for these standard library functions when compiling with 'gnustl_cpp'
+template<typename T>
+std::string to_string(T value) {
+ std::ostringstream os;
+ os << value;
+ return os.str();
+}
+inline double stod(const std::string& value) {
+ return -1.0; // Not implemented
+}
+inline int stoi( const std::string& str, std::size_t* pos = 0, int base = 10) {
+ char * p_end;
+ const auto result = std::strtol(str.c_str(), &p_end, base);
+ return result;
+}
+
+}
+
+// =================================================================================================
+
+// CLBLAST_ANDROID_HPP_
+#endif