From 16b3d19f7fbff35b41879a28159cb69dc647d249 Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Thu, 2 Feb 2012 22:53:26 +0000 Subject: [PATCH] # 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-9d2fd5bffc1f --- code/fast_atof.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/fast_atof.h b/code/fast_atof.h index 0d4952c46..83d033343 100644 --- a/code/fast_atof.h +++ b/code/fast_atof.h @@ -257,7 +257,7 @@ inline const char* fast_atoreal_move( const char* c, Real& out) if (*c == 'e' || *c == 'E') { ++c; - bool einv = (*c=='-'); + const bool einv = (*c=='-'); if (einv || *c=='+') { ++c; } @@ -267,13 +267,13 @@ inline const char* fast_atoreal_move( const char* c, Real& out) // bad considering how frequently fast_atoreal_move is called in Assimp. Real exp = static_cast( strtoul10_64(c, &c) ); if (einv) { - exp *= static_cast(-1.0f); + exp = -exp; } f *= pow(static_cast(10.0f), exp); } if (inv) { - f *= static_cast(-1.0f); + f = -f; } out = f; return c;