diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2017-10-29 16:45:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-29 16:45:56 +0100 |
commit | 19c53f6dd06e1fc2b3f71ab738bd97af070fe627 (patch) | |
tree | 894631428f17b75dc144def614ffde885beeca21 /src/utilities/android.hpp | |
parent | fa6e5e67f585b77d34c3031c176de9a0f7904aa9 (diff) | |
parent | f24d611e575656a8e472f46b9c5c54f3c9634378 (diff) |
Merge pull request #208 from CNugteren/android_support
Added Android support
Diffstat (limited to 'src/utilities/android.hpp')
-rw-r--r-- | src/utilities/android.hpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/utilities/android.hpp b/src/utilities/android.hpp new file mode 100644 index 00000000..64e9b3f4 --- /dev/null +++ b/src/utilities/android.hpp @@ -0,0 +1,47 @@ + +// ================================================================================================= +// 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. Note that this +// header should only be included when compiling for Android, e.g. when __ANDROID__ is defined. +// +// ================================================================================================= + +#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 the GNU C++ STL +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 std::atof(value.c_str()); +} +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 |