diff options
author | Thales Sabino <thales@codeplay.com> | 2018-07-12 11:20:59 +0100 |
---|---|---|
committer | Thales Sabino <thales@codeplay.com> | 2018-07-12 11:20:59 +0100 |
commit | 9a6a43319f31c03cda67c4ff772de339d0f19b8f (patch) | |
tree | 291a67ffa7b64440fa5c2e9a11d7c28e4caad16a /unsupported/test/cxx11_tensor_fft.cpp | |
parent | b347eb0b1c6fd0c9ee09d3493e72d68a2d514db5 (diff) |
Fix cxx11_tensor_fft not building on Windows.
The type used in Eigen::DSizes needs to be at least 8 bytes long. Internally Tensor tries to convert this to an __int64 on Windows and this fails to build. On Linux, long and long long are both 8 byte integer types.
* * *
Changing from "long long" to "std::int64_t".
Diffstat (limited to 'unsupported/test/cxx11_tensor_fft.cpp')
-rw-r--r-- | unsupported/test/cxx11_tensor_fft.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/unsupported/test/cxx11_tensor_fft.cpp b/unsupported/test/cxx11_tensor_fft.cpp index a55369477..ef5f1a312 100644 --- a/unsupported/test/cxx11_tensor_fft.cpp +++ b/unsupported/test/cxx11_tensor_fft.cpp @@ -228,10 +228,13 @@ template <typename RealScalar> static void test_fft_non_power_of_2_round_trip(int exponent) { int n = (1 << exponent) + 1; - Eigen::DSizes<long, 1> dimensions; + // The dimension type needs to be at least 8 bytes long for the + // Tensor constructor to work. On Windows, long is only 4 bytes long, + // so use long long here to force the usage of a 8 bytes integer type. + Eigen::DSizes<std::int64_t, 1> dimensions; dimensions[0] = n; - const DSizes<long, 1> arr = dimensions; - Tensor<RealScalar, 1, ColMajor, long> input; + const DSizes<std::int64_t, 1> arr = dimensions; + Tensor<RealScalar, 1, ColMajor, std::int64_t> input; input.resize(arr); input.setRandom(); @@ -242,7 +245,7 @@ static void test_fft_non_power_of_2_round_trip(int exponent) { Tensor<std::complex<RealScalar>, 1, ColMajor> forward = input.template fft<BothParts, FFT_FORWARD>(fft); - Tensor<RealScalar, 1, ColMajor, long> output = + Tensor<RealScalar, 1, ColMajor, std::int64_t> output = forward.template fft<RealPart, FFT_REVERSE>(fft); for (int i = 0; i < n; ++i) { |