Fix compiling literal numbers

blender-script
melex750 2019-05-12 08:33:53 -04:00 committed by GitHub
parent 5f089f4a9b
commit 17d0d2abb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -74,8 +74,7 @@ CBotInstr* CompileExprLitNum(CBotToken* &p, CBotCStack* pStack)
if (s.find('.') != std::string::npos || ( s.find('x') == std::string::npos && ( s.find_first_of("eE") != std::string::npos ) )) if (s.find('.') != std::string::npos || ( s.find('x') == std::string::npos && ( s.find_first_of("eE") != std::string::npos ) ))
{ {
double val = GetNumFloat(s); double val = GetNumFloat(s);
if (val < static_cast<double>(std::numeric_limits<float>::min()) && if (val > static_cast<double>(std::numeric_limits<float>::max()))
val > static_cast<double>(std::numeric_limits<float>::max()) )
{ {
numtype = CBotTypDouble; numtype = CBotTypDouble;
inst = new CBotExprLitNum<double>(val); inst = new CBotExprLitNum<double>(val);
@ -89,8 +88,7 @@ CBotInstr* CompileExprLitNum(CBotToken* &p, CBotCStack* pStack)
else else
{ {
long val = GetNumInt(s); long val = GetNumInt(s);
if (val < std::numeric_limits<int>::min() && if (val > std::numeric_limits<int>::max())
val > std::numeric_limits<int>::max() )
{ {
numtype = CBotTypLong; numtype = CBotTypLong;
inst = new CBotExprLitNum<long>(val); inst = new CBotExprLitNum<long>(val);