Expression Templates Library (ETL)
safe_cast.hpp
Go to the documentation of this file.
1 //=======================================================================
2 // Copyright (c) 2014-2023 Baptiste Wicht
3 // Distributed under the terms of the MIT License.
4 // (See accompanying file LICENSE or copy at
5 // http://opensource.org/licenses/MIT)
6 //=======================================================================
7 
17 #pragma once
18 
19 namespace etl::impl {
20 
26 inline float* safe_cast(float* in) {
27  return in;
28 }
29 
35 inline double* safe_cast(double* in) {
36  return in;
37 }
38 
44 inline std::complex<float>* safe_cast(std::complex<float>* in) {
45  return in;
46 }
47 
53 inline std::complex<double>* safe_cast(std::complex<double>* in) {
54  return in;
55 }
56 
62 inline std::complex<float>* safe_cast(etl::complex<float>* in) {
63  return reinterpret_cast<std::complex<float>*>(in);
64 }
65 
71 inline std::complex<double>* safe_cast(etl::complex<double>* in) {
72  return reinterpret_cast<std::complex<double>*>(in);
73 }
74 
80 inline const float* safe_cast(const float* in) {
81  return in;
82 }
83 
89 inline const double* safe_cast(const double* in) {
90  return in;
91 }
92 
98 inline const std::complex<float>* safe_cast(const std::complex<float>* in) {
99  return in;
100 }
101 
107 inline const std::complex<double>* safe_cast(const std::complex<double>* in) {
108  return in;
109 }
110 
116 inline const std::complex<float>* safe_cast(const etl::complex<float>* in) {
117  return reinterpret_cast<const std::complex<float>*>(in);
118 }
119 
125 inline const std::complex<double>* safe_cast(const etl::complex<double>* in) {
126  return reinterpret_cast<const std::complex<double>*>(in);
127 }
128 
129 } //end of namespace etl::impl
float * safe_cast(float *in)
Cast any complex pointer to etl::complex pointer.
Definition: safe_cast.hpp:26
Complex number implementation.
Definition: complex.hpp:31
Definition: avg_pooling_derivative.hpp:10