]> granicus.if.org Git - php/commitdiff
add gmp_nextprime() function
authorAntony Dovgal <tony2001@php.net>
Mon, 3 Apr 2006 17:46:12 +0000 (17:46 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 3 Apr 2006 17:46:12 +0000 (17:46 +0000)
patch by ants dot aasma at gmail dot com

NEWS
ext/gmp/gmp.c
ext/gmp/php_gmp.h

diff --git a/NEWS b/NEWS
index 03a64ab3311446649a5023bdb018e245ec6907bb..230cf1da6c6d310a32269e0ba28dee3259e603ac 100644 (file)
--- 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)
index c946b8ff9c8f4e3c2b5e5fd128a4eca0ff54c5d4..08c5fbe420700bdea59d28a12edd90bdcb60862f 100644 (file)
@@ -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)
index 7ad54723f1b353b1f7bb5d6f42dfa559c97aa90e..5af36159731bb457b6a369d2956d38d16024ba32 100644 (file)
@@ -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;