File tree 1 file changed +12
-1
lines changed 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 {
204
204
#define GMP_ROUND_PLUSINF 1
205
205
#define GMP_ROUND_MINUSINF 2
206
206
207
+ #define GMP_42_OR_NEWER \
208
+ ((__GNU_MP_VERSION >= 5) || (__GNU_MP_VERSION >= 4 && __GNU_MP_VERSION_MINOR >= 2))
209
+
207
210
/* The maximum base for input and output conversions is 62 from GMP 4.2
208
211
* onwards. */
209
- #if ( __GNU_MP_VERSION >= 5 ) || ( __GNU_MP_VERSION >= 4 && __GNU_MP_VERSION_MINOR >= 2 )
212
+ #if GMP_42_OR_NEWER
210
213
# define MAX_BASE 62
211
214
#else
212
215
# define MAX_BASE 36
@@ -1455,7 +1458,15 @@ ZEND_FUNCTION(gmp_rootrem)
1455
1458
add_index_zval (return_value , 0 , gmp_create (& gmpnum_result1 TSRMLS_CC ));
1456
1459
add_index_zval (return_value , 1 , gmp_create (& gmpnum_result2 TSRMLS_CC ));
1457
1460
1461
+ #if GMP_42_OR_NEWER
1458
1462
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
+
1459
1470
FREE_GMP_TEMP (temp_a );
1460
1471
}
1461
1472
/* }}} */
You can’t perform that action at this time.
0 commit comments