Fix 32-bit Android build for ARMv7 (#842)

Tested with currently supported Android NDK r21d.

Signed-off-by: James Morrissey <james.morrissey@arm.com>
This commit is contained in:
james-morrissey-arm
2020-07-24 14:30:41 +01:00
committed by GitHub
parent 0ee260b036
commit dda37d93f7
2 changed files with 9 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ set (${MODULE_NAME}_SOURCES
Sleep.cpp test_conversions.cpp basic_test_conversions.cpp
)
if(CMAKE_COMPILER_IS_GNUCXX AND "${CLConform_TARGET_ARCH}" STREQUAL "ARM")
if("${CLConform_TARGET_ARCH}" STREQUAL "ARM")
list(APPEND ${MODULE_NAME}_SOURCES fplib.cpp)
endif()

View File

@@ -17,7 +17,9 @@
#include <math.h>
#include "fplib.h"
#if !defined(FLT_MANT_DIG)
#define FLT_MANT_DIG 24
#endif
#define as_float(x) (*((float *)(&x)))
#define as_long(x) (*((int64_t *)(&x)))
@@ -145,6 +147,9 @@ float qcom_s64_2_f32(int64_t data, bool sat, roundingMode rnd)
return as_float(result);
}
}
case qcomRoundingModeCount: {
break; // Avoid build error for unhandled enum value
}
}
return 0.0f;
}
@@ -216,6 +221,9 @@ float qcom_u64_2_f32(uint64_t data, bool sat, roundingMode rnd)
uint32_t result = exponent | mantissa;
return as_float(result); // for positive inputs return RTZ result
}
case qcomRoundingModeCount: {
break; // Avoid build error for unhandled enum value
}
}
return 0.0f;
}