Closed jlick closed 3 years ago
Thank you.
I find it odd that following is not valid:
min(8LL, some_int64_var);
Apparently int64_t
becomes long
on 64bit systems, and thus it becomes min(long long, long)..
Even worse it also depends on OS and compiler how big long and long long are on 32-bit and 64-bit systems. Anyhow, thanks for the quick fix.
d6f0790 successfully compiles on:
Debian buster 32-bit Debian buster 64-bit Raspbian buster 32-bit
On a 64-bit Debian 10 buster system the following compilation method works without issue:
However, on a substantially similar 32-bit Debian buster system, the same compilation method fails with the following errors:
These errors are due to the compiler implicitly assuming the type of the first argument of this call to min to be 32-bit on 32-bit systems and 64-bit on 64-bit systems, while the second argument is always a 64-bit value. This creates a type incompatibility which the compiler rejects.
This can be fixed by changing this line to the following to force the first argument to be 64-bit:
auto sz = min(static_cast<int64_t>(8), current_mdat_->contentSize() - end_off);
After this change, make finishes without error and the resulting binary appears to work correctly.