Skip to content

Commit

Permalink
Merge pull request #275 from CC493/master
Browse files Browse the repository at this point in the history
Make SimdPoint constexpr
  • Loading branch information
ermig1979 authored Aug 9, 2024
2 parents 94d7351 + 238402c commit f388e4f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
12 changes: 11 additions & 1 deletion src/Simd/SimdLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ typedef unsigned __int64 uint64_t;
#if __cplusplus >= 201703L
#define SIMD_CPP_2017_ENABLE
#endif

#if __cplusplus >= 202002L
#define SIMD_CPP_2020_ENABLE
#endif
#endif

#if defined(SIMD_CPP_2020_ENABLE)
#define SIMD_CONSTEXPR constexpr
#else
#define SIMD_CONSTEXPR
#endif

#if defined(SIMD_CPP_2014_ENABLE)
Expand Down Expand Up @@ -7296,7 +7306,7 @@ extern "C"
\param [in] kernelC - a channel size of the pooling kernel in 3D case. In 2D case it must be equal to 1.
\param [in] kernelY - a height of the pooling kernel.
\param [in] kernelX - a width of the pooling kernel.
\param [in] strideC - a ñ-stride of the pooling in 3D case. In 2D case it must be equal to 1.
\param [in] strideC - a -stride of the pooling in 3D case. In 2D case it must be equal to 1.
\param [in] strideY - a y-stride of the pooling.
\param [in] strideX - a x-stride of the pooling.
\param [in] padC - a channel pad to the begin of the input image.
Expand Down
10 changes: 5 additions & 5 deletions src/Simd/SimdPoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ namespace Simd
\param [in] tx - initial X value.
\param [in] ty - initial Y value.
*/
template <typename TX, typename TY> Point(TX tx, TY ty);
template <typename TX, typename TY> SIMD_CONSTEXPR Point(TX tx, TY ty);

/*!
Creates a new Point structure on the base of another point of arbitrary type.
Expand All @@ -108,7 +108,7 @@ namespace Simd
/*!
A point destructor.
*/
~Point();
SIMD_CONSTEXPR ~Point();

/*!
Converts itself to point of arbitrary type.
Expand Down Expand Up @@ -371,7 +371,7 @@ namespace Simd
#endif

template <class TD, class TS>
SIMD_INLINE TD Convert(TS src)
SIMD_INLINE SIMD_CONSTEXPR TD Convert(TS src)
{
return (TD)src;
}
Expand All @@ -396,7 +396,7 @@ namespace Simd
}

template <typename T> template <typename TX, typename TY>
SIMD_INLINE Point<T>::Point(TX tx, TY ty)
SIMD_INLINE SIMD_CONSTEXPR Point<T>::Point(TX tx, TY ty)
: x(Convert<T, TX>(tx))
, y(Convert<T, TY>(ty))
{
Expand All @@ -419,7 +419,7 @@ namespace Simd
#endif

template <typename T>
SIMD_INLINE Point<T>::~Point()
SIMD_INLINE SIMD_CONSTEXPR Point<T>::~Point()
{
}

Expand Down

0 comments on commit f388e4f

Please sign in to comment.