Skip to content
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

Explicitly use std::pow. #866

Merged
merged 1 commit into from
May 16, 2023
Merged

Explicitly use std::pow. #866

merged 1 commit into from
May 16, 2023

Conversation

0-wiz-0
Copy link
Contributor

@0-wiz-0 0-wiz-0 commented May 16, 2023

This fixes a build failure on SmartOS, see
https://us-central.manta.mnx.io/pkgsrc/public/reports/upstream-trunk/20230514.2249/libheif-1.16.1/build.log

/home/pbulk/build/graphics/libheif/work/libheif-1.16.1/libheif/hevc.cc: In function 'double read_depth_rep_info_element(BitReader&)':
/home/pbulk/build/graphics/libheif/work/libheif-1.16.1/libheif/hevc.cc:46:16: error: call of overloaded 'pow(int, int)' is ambiguous
   46 |     value = pow(2, exponent - 31) * (1.0 + mantissa / pow(2, mantissa_len));
      |             ~~~^~~~~~~~~~~~~~~~~~

@farindk
Copy link
Contributor

farindk commented May 16, 2023

Your compiler output looks like the actual problem is that it cannot decide between pow(float, int) and pow(double, int).
Hence, a better fix could be to replace the pow(2, ...) with pow(2.0, ...).

Can you please try if that works?

@0-wiz-0 0-wiz-0 force-pushed the master branch 2 times, most recently from 9f73287 to bc71ea3 Compare May 16, 2023 10:07
@0-wiz-0
Copy link
Contributor Author

0-wiz-0 commented May 16, 2023

Yes, that works too. I've adapted the diff. Thanks for the suggestion!

@farindk
Copy link
Contributor

farindk commented May 16, 2023

There is another pow() in the first of the two lines. Why doesn't the compiler complain about that one?
I guess this should also get a 2.0.

@0-wiz-0
Copy link
Contributor Author

0-wiz-0 commented May 16, 2023

Yeah, sorry for that.
I'm reporting this for another party that provided the fix and okayed your alternative solution, and I created the new patch and missed the third pow; this went unnoticed because I don't have access to the system.
New version pushed.

@farindk farindk merged commit 9f76275 into strukturag:master May 16, 2023
31 checks passed
@farindk
Copy link
Contributor

farindk commented May 16, 2023

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants