MGARD icon indicating copy to clipboard operation
MGARD copied to clipboard

fix data type in test to pass build

Open JasonRuonanWang opened this issue 3 years ago • 3 comments

This was broken on Mac with mgard_x serial option enabled.

JasonRuonanWang avatar Mar 14 '22 23:03 JasonRuonanWang

@qliu21, please hold off on merging this until we discuss it at a Tuesday meeting. This issue has come up in my rewrite of the Huffman compression code.

@JasonRuonanWang, were you getting a build error? Are std::int64_t and long int not the same type on your architecture?

ben-e-whitney avatar Jun 17 '22 16:06 ben-e-whitney

Are std::int64_t and long int not the same type on your architecture?

See this error encountered in #189.

ben-e-whitney avatar Jul 11 '22 13:07 ben-e-whitney

Apple clang thinks they're different types. This code

#include <cstdint>
#include <iostream>

template <typename T>
bool is_int64() { return std::is_same<T, std::int64_t>(); }

int main()
{
 std::cout << "int:           " << is_int64<int>() << std::endl;
 std::cout << "int64_t:       " << is_int64<int64_t>() << std::endl;
 std::cout << "long int:      " << is_int64<long int>() << std::endl;
 std::cout << "long long int: " << is_int64<long long int>() << std::endl;
 return 0;
}

outputs

int:           0
int64_t:       1
long int:      0
long long int: 1

long and long long have the same size and representation but are distinct types.

lindstro avatar Jul 18 '22 17:07 lindstro