# fast_atoreal_move: avoid floating-point casts. Compilers have trouble optimizing this.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1144 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/5/head
parent
15e50959e6
commit
16b3d19f7f
|
@ -257,7 +257,7 @@ inline const char* fast_atoreal_move( const char* c, Real& out)
|
||||||
if (*c == 'e' || *c == 'E') {
|
if (*c == 'e' || *c == 'E') {
|
||||||
|
|
||||||
++c;
|
++c;
|
||||||
bool einv = (*c=='-');
|
const bool einv = (*c=='-');
|
||||||
if (einv || *c=='+') {
|
if (einv || *c=='+') {
|
||||||
++c;
|
++c;
|
||||||
}
|
}
|
||||||
|
@ -267,13 +267,13 @@ inline const char* fast_atoreal_move( const char* c, Real& out)
|
||||||
// bad considering how frequently fast_atoreal_move<float> is called in Assimp.
|
// bad considering how frequently fast_atoreal_move<float> is called in Assimp.
|
||||||
Real exp = static_cast<Real>( strtoul10_64(c, &c) );
|
Real exp = static_cast<Real>( strtoul10_64(c, &c) );
|
||||||
if (einv) {
|
if (einv) {
|
||||||
exp *= static_cast<Real>(-1.0f);
|
exp = -exp;
|
||||||
}
|
}
|
||||||
f *= pow(static_cast<Real>(10.0f), exp);
|
f *= pow(static_cast<Real>(10.0f), exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inv) {
|
if (inv) {
|
||||||
f *= static_cast<Real>(-1.0f);
|
f = -f;
|
||||||
}
|
}
|
||||||
out = f;
|
out = f;
|
||||||
return c;
|
return c;
|
||||||
|
|
Loading…
Reference in New Issue