PHP_METHOD(PocketMine_Math_Vector2, subtract) { int ZEPHIR_LAST_CALL_STATUS; zval *x, *y = NULL, *_0 = NULL, *_1, *_2; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &x, &y); if (!y) { ZEPHIR_INIT_VAR(y); ZVAL_LONG(y, 0); } if (zephir_instance_of_ev(x, pocketmine_math_vector2_ce TSRMLS_CC)) { ZEPHIR_OBS_VAR(_1); zephir_read_property(&_1, x, SL("x"), PH_NOISY_CC); zephir_negate(_1 TSRMLS_CC); ZEPHIR_OBS_VAR(_2); zephir_read_property(&_2, x, SL("y"), PH_NOISY_CC); zephir_negate(_2 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_0, this_ptr, "add", NULL, _1, _2); zephir_check_call_status(); RETURN_CCTOR(_0); } zephir_negate(x TSRMLS_CC); zephir_negate(y TSRMLS_CC); ZEPHIR_CALL_METHOD(&_0, this_ptr, "add", NULL, x, y); zephir_check_call_status(); RETURN_CCTOR(_0); }
PHP_METHOD(Test_Arithmetic, letStatementVarMinus) { zval *b, *a = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &b); zephir_negate(b TSRMLS_CC); ZEPHIR_CPY_WRT(a, b); RETURN_CCTOR(a); }
/** * Boolean var can`t be -1 when we set -1 */ PHP_METHOD(Test_Arithmetic, letStatementBoolMinus) { zend_bool a = 0; zval *b; zephir_fetch_params(0, 1, 0, &b); zephir_negate(b TSRMLS_CC); a = zephir_is_true(b); RETURN_BOOL(a); }