Removed constexpr for etl::bit_cast due to unreliability of compiler support

This commit is contained in:
John Wellbelove 2022-10-23 19:48:49 +01:00
parent 5cae6659ba
commit b0266fcc4a

View File

@ -50,7 +50,6 @@ namespace etl
/// bit_cast
//***************************************************************************
template <typename TDestination, typename TSource>
ETL_CONSTEXPR14
typename etl::enable_if<(sizeof(TDestination) == sizeof(TSource)) &&
etl::is_trivially_copyable<TSource>::value &&
etl::is_trivially_copyable<TDestination>::value, TDestination>::type
@ -58,19 +57,7 @@ namespace etl
{
TDestination destination;
#if defined(__has_builtin)
#if __has_builtin(__builtin_memcpy)
#define ETL_USE_BUILTIN_MEMCPY
#endif
#endif
#if defined(ETL_USE_BUILTIN_MEMCPY)
__builtin_memcpy(&destination, &source, sizeof(TDestination));
#else
memcpy(&destination, &source, sizeof(TDestination));
#endif
#undef ETL_USE_BUILTIN_MEMCPY
return destination;
}