commit 27ebc37a0ab641fdc12341254ba9650e1156a71b
parent 08098d02fdea5a1e7ba933d16cd23c8ba99b067f
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date: Mon, 8 Aug 2016 04:37:13 +0300
GCC 4.8 support
Diffstat:
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/include/kfr/base/types.hpp b/include/kfr/base/types.hpp
@@ -739,7 +739,7 @@ template <typename... Ts>
using is_numeric_args = and_t<is_numeric<Ts>...>;
template <typename T, cpu_t c = cpu_t::native>
-constexpr size_t vector_width = std::max(size_t(1), typeclass<T> == datatype::f
+constexpr size_t vector_width = cmax(size_t(1), typeclass<T> == datatype::f
? native_float_vector_size<c> / sizeof(T)
: native_int_vector_size<c> / sizeof(T));
@@ -750,7 +750,7 @@ namespace internal
{
template <cpu_t c>
-constexpr size_t native_vector_alignment = std::max(native_float_vector_size<c>, native_int_vector_size<c>);
+constexpr size_t native_vector_alignment = cmax(native_float_vector_size<c>, native_int_vector_size<c>);
template <cpu_t c>
constexpr bool fast_unaligned =
@@ -781,7 +781,7 @@ template <typename T, cpu_t c>
constexpr size_t vector_capacity = native_register_count* vector_width<T, c>;
template <typename T, cpu_t c>
-constexpr size_t maximum_vector_size = std::min(static_cast<size_t>(32), vector_capacity<T, c> / 4);
+constexpr size_t maximum_vector_size = cmin(static_cast<size_t>(32), vector_capacity<T, c> / 4);
}
}
namespace cometa
diff --git a/include/kfr/cident.h b/include/kfr/cident.h
@@ -13,6 +13,10 @@
#define CMT_ARCH_X32 1
#endif
+#ifdef LIBC_WORKAROUND_GETS
+extern char *gets (char *__s);
+#endif
+
#if defined __AVX512F__ && !defined CMT_ARCH_AVX512
#define CMT_ARCH_AVX512 1
#define CMT_ARCH_AVX2 1
diff --git a/include/kfr/cometa.hpp b/include/kfr/cometa.hpp
@@ -22,6 +22,18 @@ using pvoid = void*;
template <typename...>
using void_t = void;
+// Workaround for GCC 4.8
+template <typename T>
+constexpr const T& cmax(const T& x, const T& y)
+{
+ return x > y ? x : y;
+}
+template <typename T>
+constexpr const T& cmin(const T& x, const T& y)
+{
+ return x < y ? x : y;
+}
+
namespace details
{
constexpr inline bool args_or() { return false; }