| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public static function bnNumBits(GmpMath $adapter, \GMP $x) |
||
| 19 | { |
||
| 20 | $zero = gmp_init(0, 10); |
||
| 21 | if ($adapter->equals($x, $zero)) { |
||
| 22 | return 0; |
||
| 23 | } |
||
| 24 | |||
| 25 | $log2 = 0; |
||
| 26 | while (false === $adapter->equals($x, $zero)) { |
||
| 27 | $x = $adapter->rightShift($x, 1); |
||
| 28 | $log2++; |
||
| 29 | } |
||
| 30 | |||
| 31 | return $log2 ; |
||
| 32 | } |
||
| 33 | } |
||
| 34 |