gnuradio / volk

The Vector Optimized Library of Kernels
http://libvolk.org
GNU Lesser General Public License v3.0
557 stars 202 forks source link

64-bit integer testing is broken #681

Closed argilo closed 11 months ago

argilo commented 1 year ago

The icompare function casts all inputs to int before comparing & printing them. This prevents errors in upper bits from being caught, and makes it difficult to diagnose failures.

https://github.com/gnuradio/volk/blob/e853e9bb5693c7800840b736e77db52d713d553e/lib/qa_utils.cc#L463-L480

jdemel commented 1 year ago

We could use long long int cf. Int types.

However, the fundamental int types just feel broken. I assume we should #include <cstdint> and use fixed width integer types.

In this specific case int64_t would be correct. Though, this type is marked optional.

jdemel commented 1 year ago

If we change this line: https://github.com/gnuradio/volk/blob/d5b317c17efd23f6c6cd9a52584123e1a7545452/lib/qa_utils.cc#L493 to

if (((unsigned int)abs(int64_t(((t*)(in1))[i]) - int64_t(((t*)(in2))[i]))) > tol) { 

we should be good. Technically, a #include <cstdint> line is required as well.