]> granicus.if.org Git - php/commitdiff
- Really implement bool increment/decrement as flip-flop.
authorAndi Gutmans <andi@php.net>
Mon, 15 Jul 2002 04:11:13 +0000 (04:11 +0000)
committerAndi Gutmans <andi@php.net>
Mon, 15 Jul 2002 04:11:13 +0000 (04:11 +0000)
Zend/zend_operators.c

index fef83c6d48eaf765c716e4fb2851fb65ec03f6b5..1de3364d21f75726716d125d78e4bede8f854def 100644 (file)
@@ -1451,9 +1451,7 @@ ZEND_API int increment_function(zval *op1)
 {
        switch (op1->type) {
                case IS_BOOL:
-                       if (!op1->value.lval) {
-                               op1->value.lval = 1;
-                       }
+                       op1->value.lval = !op1->value.lval;
                        break;
                case IS_LONG:
                        if(op1->value.lval == LONG_MAX) {
@@ -1518,11 +1516,7 @@ ZEND_API int decrement_function(zval *op1)
        
        switch (op1->type) {
                case IS_BOOL:
-                       if (op1->value.lval) {
-                               op1->value.lval = 0;
-                       } else {
-                               op1->value.lval = 1;
-                       }
+                       op1->value.lval = !op1->value.lval;
                        break;
                case IS_LONG:
                        if(op1->value.lval == LONG_MIN) {