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 warnings about types passed to abs() functions #68

Closed
wants to merge 2 commits into from

Conversation

leecbaker
Copy link

@leecbaker leecbaker commented Jun 9, 2016

Use different versions of abs() based on the data types passed to them.

Fixes warnings when building with clang on OS X.

Warnings are similar to:

bwa.c:147:18: warning: absolute value function 'abs' given an argument of type
      'long long' but has parameter of type 'int' which may cause truncation of
      value [-Wabsolute-value]
                w = (max_gap + abs(rlen - l_query) + 1) >> 1;
                               ^
bwa.c:147:18: note: use function 'llabs' instead
                w = (max_gap + abs(rlen - l_query) + 1) >> 1;
                               ^~~
                               llabs

w = w < w_? w : w_;
min_w = abs(rlen - l_query) + 3;
min_w = llabs(rlen - l_query) + 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

But w and min_w are ints…

@leecbaker
Copy link
Author

Updated the PR to truncate the int64_t parameters to int before doing the abs(). I think this should address concerns about the return type.

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.

2 participants