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