Tests if bit is set in a */
ZEND_FUNCTION(gmp_testbit)
{
- zval **a_arg, **ind_arg;
+ zval *a_arg;
+ long ind_arg;
int index;
mpz_t *gmpnum_a;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &ind_arg) == FAILURE){
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &a_arg, &ind_arg) == FAILURE) {
+ return;
}
- ZEND_FETCH_RESOURCE(gmpnum_a, mpz_t *, a_arg, -1, GMP_RESOURCE_NAME, le_gmp);
+ ZEND_FETCH_RESOURCE(gmpnum_a, mpz_t *, &a_arg, -1, GMP_RESOURCE_NAME, le_gmp);
- convert_to_long_ex(ind_arg);
- index = Z_LVAL_PP(ind_arg);
+ index = ind_arg;
if (index < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Index must be greater than or equal to zero");