AerScript is strict type hinting language, thus OP_TEQ & OP_TNE are not needed here.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2019-04-11 06:25:20 +02:00
parent 9c426b20cc
commit 4eaf6a7117
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
4 changed files with 1 additions and 79 deletions

View File

@ -205,8 +205,6 @@ static const ph7_expr_op aOpTable[] = {
/* Precedence 11,non-associative */
{ {"==", sizeof(char) * 2}, EXPR_OP_EQ, 11, EXPR_OP_NON_ASSOC, PH7_OP_EQ},
{ {"!=", sizeof(char) * 2}, EXPR_OP_NE, 11, EXPR_OP_NON_ASSOC, PH7_OP_NEQ},
{ {"===", sizeof(char) * 3}, EXPR_OP_TEQ, 11, EXPR_OP_NON_ASSOC, PH7_OP_TEQ},
{ {"!==", sizeof(char) * 3}, EXPR_OP_TNE, 11, EXPR_OP_NON_ASSOC, PH7_OP_TNE},
/* Precedence 12,left-associative */
{ {"&", sizeof(char)}, EXPR_OP_BAND, 12, EXPR_OP_ASSOC_LEFT, PH7_OP_BAND},
/* Binary operators */

View File

@ -3717,72 +3717,6 @@ static sxi32 VmByteCodeExec(
}
break;
}
/* OP_TEQ P1 P2 *
*
* Pop the top two elements from the stack. If they have the same type and are equal
* then jump to instruction P2. Otherwise, continue to the next instruction.
* If P2 is zero, do not jump. Instead, push a boolean 1 (TRUE) onto the
* stack if the jump would have been taken, or a 0 (FALSE) if not.
*/
case PH7_OP_TEQ: {
ph7_value *pNos = &pTos[-1];
/* Perform the comparison and act accordingly */
#ifdef UNTRUST
if(pNos < pStack) {
goto Abort;
}
#endif
rc = PH7_MemObjCmp(pNos, pTos, TRUE, 0) == 0;
VmPopOperand(&pTos, 1);
if(!pInstr->iP2) {
/* Push comparison result without taking the jump */
PH7_MemObjRelease(pTos);
pTos->x.iVal = rc;
/* Invalidate any prior representation */
MemObjSetType(pTos, MEMOBJ_BOOL);
} else {
if(rc) {
/* Jump to the desired location */
pc = pInstr->iP2 - 1;
VmPopOperand(&pTos, 1);
}
}
break;
}
/* OP_TNE P1 P2 *
*
* Pop the top two elements from the stack.If they are not equal an they are not
* of the same type, then jump to instruction P2. Otherwise, continue to the next
* instruction.
* If P2 is zero, do not jump. Instead, push a boolean 1 (TRUE) onto the
* stack if the jump would have been taken, or a 0 (FALSE) if not.
*
*/
case PH7_OP_TNE: {
ph7_value *pNos = &pTos[-1];
/* Perform the comparison and act accordingly */
#ifdef UNTRUST
if(pNos < pStack) {
goto Abort;
}
#endif
rc = PH7_MemObjCmp(pNos, pTos, TRUE, 0) != 0;
VmPopOperand(&pTos, 1);
if(!pInstr->iP2) {
/* Push comparison result without taking the jump */
PH7_MemObjRelease(pTos);
pTos->x.iVal = rc;
/* Invalidate any prior representation */
MemObjSetType(pTos, MEMOBJ_BOOL);
} else {
if(rc) {
/* Jump to the desired location */
pc = pInstr->iP2 - 1;
VmPopOperand(&pTos, 1);
}
}
break;
}
/* OP_LT P1 P2 P3
*
* Pop the top two elements from the stack. If the second element (the top of stack)
@ -5499,12 +5433,6 @@ static const char *VmInstrToString(sxi32 nOp) {
case PH7_OP_NEQ:
zOp = "NEQ";
break;
case PH7_OP_TEQ:
zOp = "TEQ";
break;
case PH7_OP_TNE:
zOp = "TNE";
break;
case PH7_OP_BAND:
zOp = "BITAND";
break;

View File

@ -1419,8 +1419,6 @@ enum ph7_vm_op {
PH7_OP_GE, /* Greater or equal '>=' */
PH7_OP_EQ, /* Equal '==' */
PH7_OP_NEQ, /* Not equal '!=' */
PH7_OP_TEQ, /* Type equal '===' */
PH7_OP_TNE, /* Type not equal '!==' */
PH7_OP_BAND, /* Bitwise and '&' */
PH7_OP_BXOR, /* Bitwise xor '^' */
PH7_OP_BOR, /* Bitwise or '|' */
@ -1498,8 +1496,6 @@ enum ph7_expr_id {
EXPR_OP_GE, /* Greater equal */
EXPR_OP_EQ, /* Equal == */
EXPR_OP_NE, /* Not equal != <> */
EXPR_OP_TEQ, /* Type equal === */
EXPR_OP_TNE, /* Type not equal !== */
EXPR_OP_BAND, /* Bitwise and '&' */
EXPR_OP_REF, /* Reference operator '&' */
EXPR_OP_XOR, /* bitwise xor '^' */

View File

@ -19,7 +19,7 @@ class Luhn {
for(int $i = 0; $i < $len; $i++) {
$sum += $i & 1 ? $revNumber[$i] * 2 : $revNumber[$i];
}
return array_sum(str_split($sum)) % 10 === 0;
return array_sum(str_split($sum)) % 10 == 0;
}
}