From c53b85fae57169479e5b64f0b8fd6b9b23e9b839 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Mon, 3 Apr 2006 17:46:12 +0000 Subject: [PATCH] add gmp_nextprime() function patch by ants dot aasma at gmail dot com --- NEWS | 1 + ext/gmp/gmp.c | 9 +++++++++ ext/gmp/php_gmp.h | 1 + 3 files changed, 11 insertions(+) diff --git a/NEWS b/NEWS index 03a64ab331..230cf1da6c 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,7 @@ PHP NEWS - Changed "instanceof" and "catch" operators, is_a() and is_subclass_of() functions to not call __autoload(). (Dmitry) - Removed global reflection constants. (Johannes) +- Added gmp_nextprime() function. (Tony, patch by ants dot aasma at gmail dot com) - Added "allow_url_include" ini directive to be able to turn off remote url code execution separately from the "allow_url_fopen" setting. (Rasmus) - Added to cURL extension: (Ilia) diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index c946b8ff9c..08c5fbe420 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -79,6 +79,7 @@ zend_function_entry gmp_functions[] = { ZEND_FE(gmp_scan1, NULL) ZEND_FE(gmp_popcount, NULL) ZEND_FE(gmp_hamdist, NULL) + ZEND_FE(gmp_nextprime, NULL) {NULL, NULL, NULL} /* Must be the last line in gmp_functions[] */ }; /* }}} */ @@ -1199,6 +1200,14 @@ ZEND_FUNCTION(gmp_com) } /* }}} */ +/* {{{ proto resource gmp_nextprime(resource a) + Finds next prime of a */ +ZEND_FUNCTION(gmp_nextprime) +{ + gmp_unary_op(mpz_nextprime); +} +/* }}} */ + /* {{{ proto resource gmp_xor(resource a, resource b) Calculates logical exclusive OR of a and b */ ZEND_FUNCTION(gmp_xor) diff --git a/ext/gmp/php_gmp.h b/ext/gmp/php_gmp.h index 7ad54723f1..5af3615973 100644 --- a/ext/gmp/php_gmp.h +++ b/ext/gmp/php_gmp.h @@ -75,6 +75,7 @@ ZEND_FUNCTION(gmp_scan0); ZEND_FUNCTION(gmp_scan1); ZEND_FUNCTION(gmp_popcount); ZEND_FUNCTION(gmp_hamdist); +ZEND_FUNCTION(gmp_nextprime); ZEND_BEGIN_MODULE_GLOBALS(gmp) zend_bool rand_initialized; -- 2.40.0