Commit 6bffbb2
authored
Fix pointer aliasing in kdtree
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.1 parent 36f571d commit 6bffbb2
1 file changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
130 | | - | |
131 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
132 | 135 | | |
133 | 136 | | |
134 | 137 | | |
| |||
207 | 210 | | |
208 | 211 | | |
209 | 212 | | |
210 | | - | |
| 213 | + | |
0 commit comments