Merge branch 'PHP-5.6'

Conflicts:
	ext/gmp/gmp.c
This commit is contained in:
Nikita Popov 2015-04-16 16:31:53 +02:00
commit c669aaac71
4 changed files with 16 additions and 5 deletions

View File

@ -245,6 +245,9 @@ typedef struct _gmp_temp {
#define GMP_MAX_BASE 62
#define GMP_51_OR_NEWER \
((__GNU_MP_VERSION >= 6) || (__GNU_MP_VERSION >= 5 && __GNU_MP_VERSION_MINOR >= 1))
#define IS_GMP(zval) \
(Z_TYPE_P(zval) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zval), gmp_ce))
@ -1575,7 +1578,15 @@ ZEND_FUNCTION(gmp_rootrem)
add_next_index_zval(return_value, &result1);
add_next_index_zval(return_value, &result2);
#if GMP_51_OR_NEWER
/* mpz_rootrem() is supported since GMP 4.2, but buggy wrt odd roots
* of negative numbers */
mpz_rootrem(gmpnum_result1, gmpnum_result2, gmpnum_a, (gmp_ulong) nth);
#else
mpz_root(gmpnum_result1, gmpnum_a, (gmp_ulong) nth);
mpz_pow_ui(gmpnum_result2, gmpnum_result1, (gmp_ulong) nth);
mpz_sub(gmpnum_result2, gmpnum_a, gmpnum_result2);
#endif
FREE_GMP_TEMP(temp_a);
}

View File

@ -13,7 +13,7 @@ var_dump(gmp_random_bits(-1));
gmp_random_bits(1);
gmp_random_bits(1024);
// 2 seconds to make sure the numbers stay in range
// 0.5 seconds to make sure the numbers stay in range
$start = microtime(true);
$limit = (2 ** 30) - 1;
while (1) {
@ -26,7 +26,7 @@ while (1) {
}
}
if (microtime(true) - $start > 2) {
if (microtime(true) - $start > 0.5) {
break;
}
}

View File

@ -30,7 +30,7 @@ gmp_random_range(-1, $plusTen);
gmp_random_range($zero, $plusTen);
gmp_random_range($minusTen, $plusTen);
// 2 seconds to make sure the numbers stay in range
// 0.5 seconds to make sure the numbers stay in range
$start = microtime(true);
while (1) {
for ($i = 0; $i < 5000; $i++) {
@ -56,7 +56,7 @@ while (1) {
}
}
if (microtime(true) - $start > 2) {
if (microtime(true) - $start > 0.5) {
break;
}
}

View File

@ -56,7 +56,7 @@ array(2) {
[1]=>
object(GMP)#%d (1) {
["num"]=>
string(2) "36"
string(3) "-36"
}
}
array(2) {