File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -204,9 +204,12 @@ typedef struct _gmp_temp {
204204#define GMP_ROUND_PLUSINF 1
205205#define GMP_ROUND_MINUSINF 2
206206
207+ #define GMP_42_OR_NEWER \
208+ ((__GNU_MP_VERSION >= 5) || (__GNU_MP_VERSION >= 4 && __GNU_MP_VERSION_MINOR >= 2))
209+
207210/* The maximum base for input and output conversions is 62 from GMP 4.2
208211 * onwards. */
209- #if ( __GNU_MP_VERSION >= 5 ) || ( __GNU_MP_VERSION >= 4 && __GNU_MP_VERSION_MINOR >= 2 )
212+ #if GMP_42_OR_NEWER
210213# define MAX_BASE 62
211214#else
212215# define MAX_BASE 36
@@ -1455,7 +1458,15 @@ ZEND_FUNCTION(gmp_rootrem)
14551458 add_index_zval (return_value , 0 , gmp_create (& gmpnum_result1 TSRMLS_CC ));
14561459 add_index_zval (return_value , 1 , gmp_create (& gmpnum_result2 TSRMLS_CC ));
14571460
1461+ #if GMP_42_OR_NEWER
14581462 mpz_rootrem (gmpnum_result1 , gmpnum_result2 , gmpnum_a , (unsigned long ) nth );
1463+ #else
1464+ mpz_root (gmpnum_result1 , gmpnum_a , (unsigned long ) nth );
1465+ mpz_pow_ui (gmpnum_result2 , gmpnum_result1 , (unsigned long ) nth );
1466+ mpz_sub (gmpnum_result2 , gmpnum_a , gmpnum_result2 );
1467+ mpz_abs (gmpnum_result2 , gmpnum_result2 );
1468+ #endif
1469+
14591470 FREE_GMP_TEMP (temp_a );
14601471}
14611472/* }}} */
You can’t perform that action at this time.
0 commit comments