parent
437ae0c839
commit
d00c4a54e6
|
@ -26,15 +26,13 @@
|
|||
#include "StringComparison.h"
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <stdint.h>
|
||||
#else
|
||||
# include <assimp/Compiler/pstdint.h>
|
||||
#endif
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
namespace Assimp {
|
||||
|
||||
const double fast_atof_table[16] = { // we write [16] here instead of [] to work around a swig bug
|
||||
0.0,
|
||||
|
@ -64,8 +62,9 @@ unsigned int strtoul10( const char* in, const char** out=0) {
|
|||
unsigned int value = 0;
|
||||
|
||||
for ( ;; ) {
|
||||
if ( *in < '0' || *in > '9' )
|
||||
if ( *in < '0' || *in > '9' ) {
|
||||
break;
|
||||
}
|
||||
|
||||
value = ( value * 10 ) + ( *in - '0' );
|
||||
++in;
|
||||
|
@ -109,8 +108,7 @@ unsigned int strtoul16( const char* in, const char** out=0) {
|
|||
value = ( value << 4u ) + ( *in - 'A' ) + 10;
|
||||
} else if (*in >= 'a' && *in <= 'f') {
|
||||
value = ( value << 4u ) + ( *in - 'a' ) + 10;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
++in;
|
||||
|
@ -258,7 +256,7 @@ int64_t strtol10_64(const char* in, const char** out = 0, unsigned int* max_inou
|
|||
//! about 6 times faster than atof in win32.
|
||||
// If you find any bugs, please send them to me, niko (at) irrlicht3d.org.
|
||||
// ------------------------------------------------------------------------------------
|
||||
template <typename Real>
|
||||
template<typename Real>
|
||||
inline
|
||||
const char* fast_atoreal_move(const char* c, Real& out, bool check_comma = true) {
|
||||
Real f = 0;
|
||||
|
@ -284,10 +282,10 @@ const char* fast_atoreal_move(const char* c, Real& out, bool check_comma = true)
|
|||
c += 5;
|
||||
}
|
||||
return c;
|
||||
|
||||
}
|
||||
|
||||
if (!(c[0] >= '0' && c[0] <= '9') &&
|
||||
!((c[0] == '.' || (check_comma && c[0] == ',')) && c[1] >= '0' && c[1] <= '9')){
|
||||
!((c[0] == '.' || (check_comma && c[0] == ',')) && c[1] >= '0' && c[1] <= '9')) {
|
||||
throw std::invalid_argument("Cannot parse string "
|
||||
"as real number: does not start with digit "
|
||||
"or decimal point followed by digit.");
|
||||
|
@ -322,7 +320,6 @@ const char* fast_atoreal_move(const char* c, Real& out, bool check_comma = true)
|
|||
// A major 'E' must be allowed. Necessary for proper reading of some DXF files.
|
||||
// Thanks to Zhao Lei to point out that this if() must be outside the if (*c == '.' ..)
|
||||
if (*c == 'e' || *c == 'E') {
|
||||
|
||||
++c;
|
||||
const bool einv = (*c=='-');
|
||||
if (einv || *c=='+') {
|
||||
|
|
Loading…
Reference in New Issue