diff options
-rw-r--r-- | common/alcomplex.cpp | 8 | ||||
-rw-r--r-- | common/alnumeric.h | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/common/alcomplex.cpp b/common/alcomplex.cpp index ee990a39..dad62d0a 100644 --- a/common/alcomplex.cpp +++ b/common/alcomplex.cpp @@ -127,8 +127,8 @@ complex_fft(const al::span<std::complex<Real>> buffer, const al::type_identity_t /* Iterative form of Danielson-Lanczos lemma */ for(size_t i{0};i < log2_size;++i) { - const size_t step2{1u << i}; - const size_t step{2u << i}; + const size_t step2{1_uz << i}; + const size_t step{2_uz << i}; /* The first iteration of the inner loop would have u=1, which we * can simplify to remove a number of complex multiplies. */ @@ -172,8 +172,8 @@ complex_fft(const al::span<std::complex<Real>> buffer, const al::type_identity_t const Real pi{al::numbers::pi_v<Real> * sign}; for(size_t i{0};i < log2_size;++i) { - const size_t step2{1u << i}; - const size_t step{2u << i}; + const size_t step2{1_uz << i}; + const size_t step{2_uz << i}; for(size_t k{0};k < fftsize;k+=step) { std::complex<Real> temp{buffer[k+step2]}; diff --git a/common/alnumeric.h b/common/alnumeric.h index 620a9bcb..759dbc12 100644 --- a/common/alnumeric.h +++ b/common/alnumeric.h @@ -5,6 +5,7 @@ #include <cmath> #include <cstddef> #include <cstdint> +#include <type_traits> #ifdef HAVE_INTRIN_H #include <intrin.h> #endif @@ -17,8 +18,13 @@ #include "opthelpers.h" -inline constexpr int64_t operator "" _i64(unsigned long long int n) noexcept { return static_cast<int64_t>(n); } -inline constexpr uint64_t operator "" _u64(unsigned long long int n) noexcept { return static_cast<uint64_t>(n); } +constexpr auto operator "" _i64(unsigned long long n) noexcept { return static_cast<int64_t>(n); } +constexpr auto operator "" _u64(unsigned long long n) noexcept { return static_cast<uint64_t>(n); } + +constexpr auto operator "" _z(unsigned long long n) noexcept +{ return static_cast<std::make_signed_t<size_t>>(n); } +constexpr auto operator "" _uz(unsigned long long n) noexcept { return static_cast<size_t>(n); } +constexpr auto operator "" _zu(unsigned long long n) noexcept { return static_cast<size_t>(n); } constexpr inline float minf(float a, float b) noexcept |