FastLED 3.9.15
Loading...
Searching...
No Matches

◆ bit_cast()

template<typename To, typename From>
To fl::bit_cast ( const From & from)
noexcept

Definition at line 39 of file bit_cast.h.

39 {
40 static_assert(sizeof(To) == sizeof(From), "bit_cast: types must have the same size");
41 static_assert(is_bitcast_compatible<To>::value, "bit_cast: destination type must be bitcast compatible");
42 static_assert(is_bitcast_compatible<From>::value, "bit_cast: source type must be bitcast compatible");
43
44 union { // robust against strict aliasing rules
45 From from_val;
46 To to_val;
47 } u;
48 u.from_val = from;
49 return u.to_val;
50}
static constexpr bool value
Definition bit_cast.h:19

References fl::is_bitcast_compatible< T >::value.

Referenced by bit_cast_ptr(), bit_cast_ptr(), int_to_ptr(), fl::Hash< float >::operator()(), fl::HashMap< Key, T, Hash, KeyEqual, INLINED_COUNT >::iterator::operator->(), ptr_to_int(), fl::WeakPtr< T >::ptr_value(), and reinterpret_pointer_cast().

+ Here is the caller graph for this function: