Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
remove unnecessary static_cast<int32_t>
Browse files Browse the repository at this point in the history
  • Loading branch information
q4a committed Jan 8, 2022
1 parent 49c97b7 commit cb30555
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 101 deletions.
12 changes: 6 additions & 6 deletions src/apps/engine/src/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1577,15 +1577,15 @@ bool COMPILER::Compile(SEGMENT_DESC &Segment, char *pInternalCode, uint32_t pInt
SetError("Invalid array '%s' initialization parameter", vi.name.c_str());
return false;
}
real_var->value->Set(static_cast<int32_t>(1));
real_var->value->Set(1);
break;
case FALSE_CONST:
if (vi.type != VAR_INTEGER)
{
SetError("Invalid array '%s' initialization parameter", vi.name.c_str());
return false;
}
real_var->value->Set(static_cast<int32_t>(0));
real_var->value->Set(0);
break;

case NUMBER:
Expand Down Expand Up @@ -1655,12 +1655,12 @@ bool COMPILER::Compile(SEGMENT_DESC &Segment, char *pInternalCode, uint32_t pInt
case TRUE_CONST:
if (vi.type != VAR_INTEGER)
break;
real_var->value->Set(static_cast<int32_t>(1));
real_var->value->Set(1);
break;
case FALSE_CONST:
if (vi.type != VAR_INTEGER)
break;
real_var->value->Set(static_cast<int32_t>(0));
real_var->value->Set(0);
break;
case NUMBER:
if (vi.type != VAR_INTEGER)
Expand Down Expand Up @@ -4270,11 +4270,11 @@ bool COMPILER::BC_Execute(uint32_t function_code, DATA *&pVReturnResult, const c
return false;
if (pVResult)
{
ExpressionResult.Set(static_cast<int32_t>(1));
ExpressionResult.Set(1);
// SStack.Pop();
}
else
ExpressionResult.Set(static_cast<int32_t>(0));
ExpressionResult.Set(0);
break;
case CALL_FUNCTION:
memcpy(&func_code, &pCodeBase[ip], sizeof(uint32_t));
Expand Down
152 changes: 76 additions & 76 deletions src/apps/engine/src/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2427,15 +2427,15 @@ bool DATA::CompareAndSetResult(DATA *pV, S_TOKEN_TYPE op)
pV = pV->GetVarPointer();
if (pV == nullptr)
{
Set(static_cast<int32_t>(0));
Set(0);
return false;
}

if (Data_type == VAR_STRING && pV->GetType() == VAR_INTEGER)
{
if (!Convert(VAR_INTEGER))
{
Set(static_cast<int32_t>(0));
Set(0);
return false;
}
}
Expand All @@ -2444,7 +2444,7 @@ bool DATA::CompareAndSetResult(DATA *pV, S_TOKEN_TYPE op)
{
if (!Convert(VAR_FLOAT))
{
Set(static_cast<int32_t>(0));
Set(0);
return false;
}
}
Expand All @@ -2463,51 +2463,51 @@ bool DATA::CompareAndSetResult(DATA *pV, S_TOKEN_TYPE op)
pV->Convert(VAR_INTEGER);
case OP_BOOL_EQUAL:
if (lValue == pV->lValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_GREATER:
if (lValue > pV->lValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_GREATER_OR_EQUAL:
if (lValue >= pV->lValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_LESSER:
if (lValue < pV->lValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_LESSER_OR_EQUAL:
if (lValue <= pV->lValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_NOT_EQUAL:
if (lValue != pV->lValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_BOOL_AND:
if (lValue != 0 && pV->lValue != 0)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_BOOL_OR:
if (lValue != 0 || pV->lValue != 0)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
}
break;
Expand All @@ -2517,56 +2517,56 @@ bool DATA::CompareAndSetResult(DATA *pV, S_TOKEN_TYPE op)
{
case OP_BOOL_EQUAL:
if (lValue == pV->fValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_GREATER:
if (lValue > pV->fValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_GREATER_OR_EQUAL:
if (lValue >= pV->fValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_LESSER:
if (lValue < pV->fValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_LESSER_OR_EQUAL:
if (lValue <= pV->fValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_NOT_EQUAL:
if (lValue != pV->fValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_BOOL_AND:
if (lValue != 0 && pV->fValue != 0)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_BOOL_OR:
if (lValue != 0 || pV->fValue != 0)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
}
break;
default:
Set(static_cast<int32_t>(0));
Set(0);
return false;
}
break;
Expand All @@ -2578,51 +2578,51 @@ bool DATA::CompareAndSetResult(DATA *pV, S_TOKEN_TYPE op)
{
case OP_BOOL_EQUAL:
if (fValue == pV->lValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_GREATER:
if (fValue > pV->lValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_GREATER_OR_EQUAL:
if (fValue >= pV->lValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_LESSER:
if (fValue < pV->lValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_LESSER_OR_EQUAL:
if (fValue <= pV->lValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_NOT_EQUAL:
if (fValue != pV->lValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_BOOL_AND:
if (fValue != 0 && pV->lValue != 0)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_BOOL_OR:
if (fValue != 0 || pV->lValue != 0)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
}
break;
Expand All @@ -2631,56 +2631,56 @@ bool DATA::CompareAndSetResult(DATA *pV, S_TOKEN_TYPE op)
{
case OP_BOOL_EQUAL:
if (fValue == pV->fValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_GREATER:
if (fValue > pV->fValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_GREATER_OR_EQUAL:
if (fValue >= pV->fValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_LESSER:
if (fValue < pV->fValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_LESSER_OR_EQUAL:
if (fValue <= pV->fValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_NOT_EQUAL:
if (fValue != pV->fValue)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_BOOL_AND:
if (fValue != 0 && pV->fValue != 0)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case OP_BOOL_OR:
if (fValue != 0 || pV->fValue != 0)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
}
break;
default:
Set(static_cast<int32_t>(0));
Set(0);
return false;
}
break;
Expand Down Expand Up @@ -2716,7 +2716,7 @@ bool DATA::CompareAndSetResult(DATA *pV, S_TOKEN_TYPE op)

break;
default:
Set(static_cast<int32_t>(0));
Set(0);
return false;
}
break;
Expand Down Expand Up @@ -2744,24 +2744,24 @@ bool DATA::BoolConvert()
{
case VAR_INTEGER:
if (lValue != 0)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case VAR_FLOAT:
if (fValue != 0)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
case VAR_STRING:
Set(static_cast<int32_t>(!sValue.empty()));
break;
case VAR_PTR:
if (pValue != 0)
Set(static_cast<int32_t>(1));
Set(1);
else
Set(static_cast<int32_t>(0));
Set(0);
break;
default:

Expand Down
Loading

0 comments on commit cb30555

Please sign in to comment.