1
0
Fork 0

tg_unique_*: make MSVC happy with the rounding

This commit is contained in:
Christian Schmitt 2012-11-24 23:04:17 +01:00
parent 05f46adacb
commit be0ff2258c
3 changed files with 14 additions and 11 deletions

View file

@ -1,4 +1,5 @@
#include <boost/unordered_set.hpp>
#include <simgear/math/SGMisc.hxx>
// Implement Unique SGVec2f list
@ -41,8 +42,8 @@ public:
/* only hash lon, lat - we want to detect dups in 2d only */
unsigned long long raw_pt[2];
raw_pt[0] = (unsigned long long)( round(vec.x() * PROXIMITY_MULTIPLIER) );
raw_pt[1] = (unsigned long long)( round(vec.y() * PROXIMITY_MULTIPLIER) );
raw_pt[0] = (unsigned long long)( SGMisc<float>::round(vec.x() * PROXIMITY_MULTIPLIER) );
raw_pt[1] = (unsigned long long)( SGMisc<float>::round(vec.y() * PROXIMITY_MULTIPLIER) );
unsigned char* it = (unsigned char*)raw_pt;
for ( unsigned i=0; i<sizeof( raw_pt ); i++ ) {
@ -124,4 +125,4 @@ int UniqueSGVec2fSet::find( const SGVec2f& v ) const {
}
return index;
}
}

View file

@ -1,4 +1,5 @@
#include <boost/unordered_set.hpp>
#include <simgear/math/SGMisc.hxx>
// Implement Unique SGVec3d list
@ -41,9 +42,9 @@ public:
/* only hash lon, lat - we want to detect dups in 2d only */
unsigned long long raw_pt[3];
raw_pt[0] = (unsigned long long)( round(vec.x() * PROXIMITY_MULTIPLIER) );
raw_pt[1] = (unsigned long long)( round(vec.y() * PROXIMITY_MULTIPLIER) );
raw_pt[2] = (unsigned long long)( round(vec.z() * PROXIMITY_MULTIPLIER) );
raw_pt[0] = (unsigned long long)( SGMisc<double>::round(vec.x() * PROXIMITY_MULTIPLIER) );
raw_pt[1] = (unsigned long long)( SGMisc<double>::round(vec.y() * PROXIMITY_MULTIPLIER) );
raw_pt[2] = (unsigned long long)( SGMisc<double>::round(vec.z() * PROXIMITY_MULTIPLIER) );
unsigned char* it = (unsigned char*)raw_pt;
for ( unsigned i=0; i<sizeof( raw_pt ); i++ ) {
@ -126,4 +127,4 @@ int UniqueSGVec3dSet::find( const SGVec3d& v ) const {
}
return index;
}
}

View file

@ -1,4 +1,5 @@
#include <boost/unordered_set.hpp>
#include <simgear/math/SGMisc.hxx>
// Implement Unique SGVec3f list
@ -41,9 +42,9 @@ public:
/* only hash lon, lat - we want to detect dups in 2d only */
unsigned long long raw_pt[3];
raw_pt[0] = (unsigned long long)( round(vec.x() * PROXIMITY_MULTIPLIER) );
raw_pt[1] = (unsigned long long)( round(vec.y() * PROXIMITY_MULTIPLIER) );
raw_pt[2] = (unsigned long long)( round(vec.z() * PROXIMITY_MULTIPLIER) );
raw_pt[0] = (unsigned long long)( SGMisc<float>::round(vec.x() * PROXIMITY_MULTIPLIER) );
raw_pt[1] = (unsigned long long)( SGMisc<float>::round(vec.y() * PROXIMITY_MULTIPLIER) );
raw_pt[2] = (unsigned long long)( SGMisc<float>::round(vec.z() * PROXIMITY_MULTIPLIER) );
unsigned char* it = (unsigned char*)raw_pt;
for ( unsigned i=0; i<sizeof( raw_pt ); i++ ) {
@ -126,4 +127,4 @@ int UniqueSGVec3fSet::find( const SGVec3f& v ) const {
}
return index;
}
}