Skip to content

Fix pointer aliasing in kdtree #36

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

Merged
merged 1 commit into from
Apr 24, 2017

Conversation

louen
Copy link
Contributor

@louen louen commented Mar 20, 2017

This commit addresses two problems related the the fast log2 computation in the kdtree :

  • The code was written with Real = double in mind which may not always be the case. The variable is now explicitly set to double.
  • GCC issues a warning for the reinterpret-cast when compiling with -fstrict-aliasing. The portable solution here is to use memcpy (according to http://dbp-consulting.com/tutorials/StrictAliasing.html) which compilers will optimize.

This commit addresses two problems related the the fast log2 computation in the kdtree :
* The code was written with Real = double in mind which may not always be the case. The variable is now explicitly set to double.
* GCC issues a warning for the reinterpret-cast when compiling with -fstrict-aliasing. The portable solution here is to use memcpy (according to http://dbp-consulting.com/tutorials/StrictAliasing.html) which compilers will optimize.
@janbender janbender merged commit c642e25 into InteractiveComputerGraphics:master Apr 24, 2017
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