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

box: Use isinf() and signbit() when isinff() is not available #188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ebassi
Copy link
Owner

@ebassi ebassi commented Jun 18, 2020

Instead of using bytewise comparison, use isinf() and hope it works
correctly with single precision floats on the target platform;
additionally, since the negative return value for negative infinities is
a GNU extension, use signbit() to check if the number is a positive or
negative infinity.

Proposed changes:

  • change the fallback path for the is_empty() and is_infinity() methods of graphene_box_t

Instead of using bytewise comparison, use isinf() and hope it works
correctly with single precision floats on the target platform;
additionally, since the negative return value for negative infinities is
a GNU extension, use signbit() to check if the number is a positive or
negative infinity.
return min_cmp == 0 && max_cmp == 0;
float vmin[3], vmax[3];

graphene_simd4f_dup_3f (box->min.value, vmin);
Copy link

Choose a reason for hiding this comment

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

You could move these out of the #ifdef branch and save some duplicated lines (same below)

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