-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cross-compile error [-Werror=conversion] #7645
Comments
Does it make any difference if you change the |
I'll try to answer that question next week. |
Unfortunately it doesn't help:
I forgot to write that this error does not occur when compiling version 7.74.0 |
The This is probably due to some limitation in the floating point handling your compiler/platform impose. |
Wrong. We also use that in debug builds without problems on my native x86-64 builds. |
I made this change in the code (similar to what was before):
After it, the compilation was successful. |
This particular suggestion makes it never use microseconds at all in the calculations so it would then probably make more sense to pass in milliseconds to begin with. Or perhaps we should divide by microseconds if the size is "large" ? |
Something like this: static curl_off_t trspeed(curl_off_t size, /* number of bytes */
curl_off_t us) /* microseconds */
{
if(us < 1)
return size * 1000000;
if(size < CURL_OFF_T_MAX/1000000)
return (size * 1000000) / us;
else if(size < CURL_OFF_T_MAX/1000)
return (size * 1000) / (us / 1000);
else
return size / (us / 1000000);
} |
and compiler warnings for data conversions. Reported-by: Michał Antoniak Fixes #7645
It works for me. Thanks for PR. |
I think we can probably also optimize away the middle check (/1000) without any particular downside. |
Indeed, I've checked the idea and also it works fine. |
I am compiling libcurl on Windows using WSL on an ARM device. I have a problem with compiling libraries in version 7.78.0. Below I present the library configuration and a compilation error. Where could the problem be?
The text was updated successfully, but these errors were encountered: