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

Fix integer truncation on abs() call #327

Merged
merged 1 commit into from
Aug 25, 2020
Merged

Conversation

nategraff-sifive
Copy link
Contributor

GCC 10 complains about possible integer truncation when passing a long int to abs().

GCC 10 complains about possible integer truncation when passing a long
int to abs().

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
Copy link
Collaborator

@bsousi5 bsousi5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nategraff-sifive nategraff-sifive merged commit f30b32a into master Aug 25, 2020
@nategraff-sifive nategraff-sifive deleted the fix-abs-truncation branch August 25, 2020 21:35
@nick-knight
Copy link

nick-knight commented Aug 25, 2020

Since the operands are of type long, better to use labs:
https://en.cppreference.com/w/c/numeric/math/abs

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.

3 participants