Req #62375 [Opn->Wfx]: Add constant "GMP_LIMB_BITS" to GMP
Edit report at https://bugs.php.net/bug.php?id=62375&edit=1
ID: 62375
Updated by: nikic@php.net
Reported by: info at bastian-born dot de
Summary: Add constant "GMP_LIMB_BITS" to GMP
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: GNU MP related
Operating System: All
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
As PHP 5.6 introduced gmp_random_bits(), which does not depend on the limb size, this should no
longer be relevant. (We would be able to introduce this constant only on versions of PHP that
already have gmp_random_bits.)
Previous Comments:
------------------------------------------------------------------------
[2015-09-24 20:43:31] rainer dot jung at kippdata dot de
Agreed, that patch would be very useful. For example the ext/gmp/tests/gmp_random_seed.phpt test
currently fails on Solaris, because it only works when GMP_LIMB_BITS is 64. On Solaris 32 Bits Sparc
it is 32 and gmp_random() produces other values.
------------------------------------------------------------------------
[2012-06-20 18:16:47] info at bastian-born dot de
Description:
------------
For the gmp_random() function you need the number of bits per limb to calculate the correct limiter
value (parameter).
This patch will register the constant "GMP_LIMB_BITS".
Test script:
---------------
<?php
echo "Bitcount: " . GMP_LIMB_BITS . "\n";
echo "Random with 128bit length: " . gmp_strval( gmp_random( 128 / GMP_LIMB_BITS ) );
Expected result:
----------------
Bitcount: 64
Random with 128bit length: 100835271651583136351260143038692948194
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62375&edit=1
Thread (5 messages)