Browse Source

Apparently Android is something like newlib.

pull/51/head
Vladimír Vondruš 12 years ago
parent
commit
2235cb76b1
  1. 4
      src/Magnum/Math/Complex.h
  2. 9
      src/Magnum/Math/Functions.h
  3. 7
      src/Magnum/Shader.cpp

4
src/Magnum/Math/Complex.h

@ -339,8 +339,8 @@ template<class T> class Complex {
* @see isNormalized() * @see isNormalized()
*/ */
T length() const { T length() const {
/** @todo Remove when NaCl's newlib has this fixed */ /** @todo Remove when newlib has this fixed */
#ifndef CORRADE_TARGET_NACL_NEWLIB #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID)
return std::hypot(_real, _imaginary); return std::hypot(_real, _imaginary);
#else #else
return std::sqrt(dot()); return std::sqrt(dot());

9
src/Magnum/Math/Functions.h

@ -251,7 +251,8 @@ template<std::size_t size, class T> Vector<size, T> floor(const Vector<size, T>&
template<class T> inline T round(const T& a); template<class T> inline T round(const T& a);
#else #else
template<class T> inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type round(T a) { template<class T> inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type round(T a) {
#ifndef CORRADE_TARGET_NACL_NEWLIB /** @todo Remove when newlib has this fixed */
#if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID)
return std::round(a); return std::round(a);
#else #else
return (a > T(0)) ? std::floor(a + T(0.5)) : std::ceil(a - T(0.5)); return (a > T(0)) ? std::floor(a + T(0.5)) : std::ceil(a - T(0.5));
@ -260,7 +261,7 @@ template<class T> inline typename std::enable_if<std::is_arithmetic<T>::value, T
template<std::size_t size, class T> Vector<size, T> round(const Vector<size, T>& a) { template<std::size_t size, class T> Vector<size, T> round(const Vector<size, T>& a) {
Vector<size, T> out; Vector<size, T> out;
for(std::size_t i = 0; i != size; ++i) { for(std::size_t i = 0; i != size; ++i) {
#ifndef CORRADE_TARGET_NACL_NEWLIB #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID)
out[i] = std::round(a[i]); out[i] = std::round(a[i]);
#else #else
out[i] = round(a[i]); out[i] = round(a[i]);
@ -396,8 +397,8 @@ Computes and returns @f$ ab + c @f$.
template<class T> inline T fma(const T& a, const T& b, const T& c); template<class T> inline T fma(const T& a, const T& b, const T& c);
#else #else
template<class T> inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type fma(T a, T b, T c) { template<class T> inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type fma(T a, T b, T c) {
/** @todo Remove when NaCl's newlib has this fixed */ /** @todo Remove when newlib has this fixed */
#ifndef CORRADE_TARGET_NACL_NEWLIB #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID)
return std::fma(a, b, c); return std::fma(a, b, c);
#else #else
return a*b + c; return a*b + c;

7
src/Magnum/Shader.cpp

@ -36,7 +36,7 @@
#include "Implementation/State.h" #include "Implementation/State.h"
#include "Implementation/ShaderState.h" #include "Implementation/ShaderState.h"
#if defined(CORRADE_TARGET_NACL_NEWLIB) || defined(__MINGW32__) #if defined(CORRADE_TARGET_NACL_NEWLIB) || defined(CORRADE_TARGET_ANDROID) || defined(__MINGW32__)
#include <sstream> #include <sstream>
#endif #endif
@ -593,7 +593,8 @@ std::vector<std::string> Shader::sources() const { return _sources; }
Shader& Shader::addSource(std::string source) { Shader& Shader::addSource(std::string source) {
if(!source.empty()) { if(!source.empty()) {
#if defined(CORRADE_TARGET_NACL_NEWLIB) || defined(__MINGW32__) /** @todo Remove when newlib has this fixed (also the include above) */
#if defined(CORRADE_TARGET_NACL_NEWLIB) || defined(CORRADE_TARGET_ANDROID) || defined(__MINGW32__)
std::ostringstream converter; std::ostringstream converter;
converter << (_sources.size()+1)/2; converter << (_sources.size()+1)/2;
#endif #endif
@ -601,7 +602,7 @@ Shader& Shader::addSource(std::string source) {
/* Fix line numbers, so line 41 of third added file is marked as 3(41). /* Fix line numbers, so line 41 of third added file is marked as 3(41).
Source 0 is the #version string added in constructor. */ Source 0 is the #version string added in constructor. */
_sources.push_back("#line 1 " + _sources.push_back("#line 1 " +
#if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(__MINGW32__) #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID) && !defined(__MINGW32__)
std::to_string((_sources.size()+1)/2) + std::to_string((_sources.size()+1)/2) +
#else #else
converter.str() + converter.str() +

Loading…
Cancel
Save