CODARcode / MGARD

MGARD: MultiGrid Adaptive Reduction of Data
Apache License 2.0
37 stars 25 forks source link

fix data type in test to pass build #186

Open JasonRuonanWang opened 2 years ago

JasonRuonanWang commented 2 years ago

This was broken on Mac with mgard_x serial option enabled.

ben-e-whitney commented 2 years ago

@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 commented 2 years ago

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

See this error encountered in #189.

lindstro commented 2 years ago

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.