Skip to content

Commit

Permalink
Fix undefined behaviour in OctNode (#3561)
Browse files Browse the repository at this point in the history
Fix undefined behaviour in `OctNode`
  • Loading branch information
taketwo authored Jan 19, 2020
2 parents fa54402 + 38cccab commit 5bfdc24
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,8 @@ namespace pcl
long long _InterleaveBits( int p[3] )
{
long long key = 0;
for( int i=0 ; i<32 ; i++ ) key |= ( ( p[0] & (1<<i) )<<(2*i) ) | ( ( p[1] & (1<<i) )<<(2*i+1) ) | ( ( p[2] & (1<<i) )<<(2*i+2) );
long long _p[3] = {p[0],p[1],p[2]};
for( int i=0 ; i<31 ; i++ ) key |= ( ( _p[0] & (1ull<<i) )<<(2*i) ) | ( ( _p[1] & (1ull<<i) )<<(2*i+1) ) | ( ( _p[2] & (1ull<<i) )<<(2*i+2) );
return key;
}
template <class NodeData,class Real>
Expand Down

0 comments on commit 5bfdc24

Please sign in to comment.