mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Removed constexpr for etl::bit_cast due to unreliability of compiler support
This commit is contained in:
parent
5cae6659ba
commit
b0266fcc4a
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user