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".
This commit is contained in:
Thales Sabino 2018-07-12 11:20:59 +01:00
parent b347eb0b1c
commit 9a6a43319f

View File

@ -228,10 +228,13 @@ template <typename RealScalar>
static void test_fft_non_power_of_2_round_trip(int exponent) { static void test_fft_non_power_of_2_round_trip(int exponent) {
int n = (1 << exponent) + 1; 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; dimensions[0] = n;
const DSizes<long, 1> arr = dimensions; const DSizes<std::int64_t, 1> arr = dimensions;
Tensor<RealScalar, 1, ColMajor, long> input; Tensor<RealScalar, 1, ColMajor, std::int64_t> input;
input.resize(arr); input.resize(arr);
input.setRandom(); 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 = Tensor<std::complex<RealScalar>, 1, ColMajor> forward =
input.template fft<BothParts, FFT_FORWARD>(fft); 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); forward.template fft<RealPart, FFT_REVERSE>(fft);
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {