| line |
true |
false |
branch |
|
85
|
0 |
105 |
if ($] < 5.02) |
|
93
|
0 |
210 |
if @options != @_ |
|
96
|
0 |
105 |
if $_Config{'xs'} and $_Config{'secure'} |
|
118
|
0 |
48 |
if defined $ENV{'MPU_NO_XS'} and $ENV{'MPU_NO_XS'} == 1 |
|
125
|
0 |
48 |
unless (eval {
do {
return 0 if defined $ENV{'MPU_NO_XS'} and $ENV{'MPU_NO_XS'} == 1;
require XSLoader;
XSLoader::load('Math::Prime::Util', $Math::Prime::Util::VERSION);
&prime_precalc(0);
$_Config{'maxbits'} = &_XS_prime_maxbits();
$_Config{'xs'} = 1;
1
}
}) |
|
127
|
0 |
0 |
unless defined $ENV{'MPU_NO_XS'} and $ENV{'MPU_NO_XS'} == 1 |
|
147
|
48 |
0 |
if (not defined $ENV{'MPU_NO_GMP'} or $ENV{'MPU_NO_GMP'} != 1) |
|
148
|
0 |
48 |
if (eval {
do {
require Math::Prime::Util::GMP;
'Math::Prime::Util::GMP'->import;
1
}
}) |
|
157
|
0 |
0 |
if ($_Config{'gmp'} >= 42 and not Math::Prime::Util::GMP::is_csprng_well_seeded() and &_is_csprng_well_seeded()) |
|
190
|
2156 |
5 |
$_Config{'xs'} ? : |
|
205
|
2 |
21 |
if ($param eq 'xs') { } |
|
|
2 |
19 |
elsif ($param eq 'gmp') { } |
|
|
2 |
17 |
elsif ($param eq 'nobigint') { } |
|
|
0 |
17 |
elsif ($param eq 'secure') { } |
|
|
0 |
17 |
elsif ($param eq 'irand') { } |
|
|
0 |
17 |
elsif ($param eq 'use_primeinc') { } |
|
|
8 |
9 |
elsif ($param =~ /^(assume[_ ]?)?[ge]?rh$/ or $param =~ /riemann\s*h/) { } |
|
|
9 |
0 |
elsif ($param eq 'verbose') { } |
|
206
|
1 |
1 |
$value ? : |
|
207
|
1 |
1 |
$_Config{'xs'} ? : |
|
209
|
0 |
2 |
$value ? : |
|
213
|
1 |
1 |
if $_Config{'xs'} |
|
215
|
1 |
1 |
$value ? : |
|
217
|
0 |
0 |
if not $value and $_Config{'secure'} |
|
218
|
0 |
0 |
if ($value) |
|
220
|
0 |
0 |
if $_Config{'xs'} |
|
227
|
4 |
4 |
$value ? : |
|
229
|
9 |
0 |
if ($value =~ /^\d+$/) { } |
|
|
0 |
0 |
elsif ($value =~ /^[ty]/i) { } |
|
|
0 |
0 |
elsif ($value =~ /^[fn]/i) { } |
|
234
|
8 |
1 |
if $_Config{'xs'} |
|
235
|
0 |
9 |
if $_Config{'gmp'} |
|
248
|
0 |
7422 |
unless (defined $Math::BigInt::VERSION) |
|
250
|
7338 |
84 |
!defined($_[0]) || ref $_[0] eq 'Math::BigInt' ? : |
|
253
|
0 |
0 |
unless (defined $Math::GMPz::VERSION) |
|
254
|
0 |
0 |
ref $_[0] eq 'Math::GMPz' ? : |
|
257
|
0 |
0 |
unless (defined $Math::GMP::VERSION) |
|
258
|
0 |
0 |
ref $_[0] eq 'Math::GMP' ? : |
|
261
|
0 |
568 |
unless defined $_[1] |
|
263
|
2 |
566 |
if ($ref0) |
|
264
|
2 |
0 |
$ref0 eq ref $_[1] ? : |
|
266
|
566 |
0 |
if (do {
$_[1] >= 0
}) { } |
|
271
|
566 |
0 |
if $_[1] <= 18446744073709551615 |
|
273
|
0 |
0 |
if '' . int($_[1]) >= -9223372036854775807 |
|
275
|
0 |
0 |
unless (defined $Math::BigInt::VERSION) |
|
284
|
0 |
64 |
unless defined $n |
|
285
|
0 |
64 |
if (ref $n eq 'CODE') |
|
289
|
51 |
13 |
if (ref $n eq 'Math::BigInt') { } |
|
|
0 |
13 |
elsif (ref $n eq 'Math::GMPz') { } |
|
290
|
0 |
51 |
if $n->sign ne '+' or not $n->is_int |
|
292
|
0 |
51 |
if $n <= '18446744073709551615' |
|
294
|
0 |
0 |
if Math::GMPz::Rmpz_sgn($n) < 0 |
|
295
|
0 |
0 |
if $n <= 18446744073709551615 |
|
298
|
0 |
13 |
if $strn eq '' or $strn =~ tr[0-9][\000-/:-\377]c and not $strn =~ /^\+?\d+$/ |
|
300
|
7 |
6 |
if ($n <= 18446744073709551615) { } |
|
301
|
0 |
7 |
if ref $n |
|
307
|
0 |
64 |
if ref $_[0] eq 'Math::BigInt' and $_[0]->upgrade |
|
308
|
0 |
64 |
if defined $min and $_[0] < $min |
|
309
|
0 |
64 |
if defined $max and $_[0] > $max |
|
317
|
117 |
1036 |
if (scalar @_ > 1) { } |
|
318
|
1 |
109 |
unless &_validate_num($low) |
|
322
|
1 |
1137 |
unless &_validate_num($high) |
|
325
|
10 |
1128 |
if $low > $high or $high < 2 |
|
327
|
1 |
1127 |
if ($high > $_XS_MAXVAL) |
|
328
|
0 |
1 |
if ($_HAVE_GMP) |
|
330
|
0 |
0 |
if ($high > 18446744073709551615) { } |
|
348
|
18 |
1109 |
if ($low + 1 >= $high or $high > 100000000000000 and $high - $low < 50000) { } |
|
|
1102 |
7 |
elsif ($high <= 1966080 or $high <= &_get_prime_cache_size()) { } |
|
375
|
18 |
2 |
if (scalar @_ > 1) { } |
|
376
|
1 |
17 |
unless &_validate_num($low) |
|
380
|
1 |
19 |
unless &_validate_num($high) |
|
382
|
0 |
20 |
if $low > $high or $high < 2 |
|
384
|
3 |
17 |
if ($high > $_XS_MAXVAL) |
|
386
|
0 |
3 |
if ($_HAVE_GMP and defined &Math::Prime::Util::GMP::sieve_twin_primes and $low > 2147483648) { } |
|
400
|
14 |
1 |
if (scalar @_ > 1) { } |
|
401
|
0 |
14 |
unless &_validate_num($low) |
|
405
|
0 |
15 |
unless &_validate_num($high) |
|
407
|
0 |
15 |
if $low > $high or $high < 2 |
|
409
|
0 |
15 |
if ($high > $_XS_MAXVAL) |
|
422
|
0 |
1 |
unless &_validate_num($bits, 2) |
|
424
|
0 |
1 |
if ($Math::Prime::Util::_GMPfunc{'random_maurer_prime_with_cert'}) |
|
435
|
0 |
1 |
unless &_validate_num($bits, 2) |
|
437
|
0 |
1 |
if ($Math::Prime::Util::_GMPfunc{'random_shawe_taylor_prime_with_cert'}) |
|
448
|
0 |
1 |
unless &_validate_num($bits, 2) |
|
451
|
0 |
1 |
if ($Math::Prime::Util::_GMPfunc{'random_maurer_prime_with_cert'}) |
|
468
|
0 |
35 |
unless &_validate_num($n) |
|
469
|
5 |
30 |
if $n < 10 |
|
471
|
0 |
30 |
if ($_HAVE_GMP and defined &Math::Prime::Util::GMP::primorial) |
|
480
|
0 |
36 |
unless &_validate_num($n) |
|
481
|
11 |
25 |
if $n < 10 |
|
483
|
0 |
25 |
if ($_HAVE_GMP and defined &Math::Prime::Util::GMP::pn_primorial) |
|
493
|
0 |
104 |
unless &_validate_num($n) |
|
494
|
1 |
103 |
if $n < 1 |
|
496
|
0 |
103 |
if ($_HAVE_GMP and defined &Math::Prime::Util::GMP::consecutive_integer_lcm) |
|
512
|
1 |
57 |
if defined $n and $n <= 0 |
|
513
|
0 |
57 |
unless &_validate_num($n) |
|
515
|
0 |
57 |
if ($_HAVE_GMP and defined &Math::Prime::Util::GMP::partitions) |
|
529
|
0 |
1 |
unless (defined $end) |
|
532
|
0 |
1 |
if $beg < 2 |
|
540
|
0 |
7 |
if &_get_forexit() |
|
548
|
0 |
1 |
unless (defined $end) |
|
551
|
0 |
1 |
if $beg < 4 |
|
552
|
0 |
1 |
if ref $end ne 'Math::BigInt' and $end == 18446744073709551615 |
|
561
|
0 |
8 |
if &_get_forexit() |
|
564
|
0 |
5 |
if &_get_forexit() |
|
572
|
0 |
1 |
unless (defined $end) |
|
575
|
0 |
1 |
if $beg < 9 |
|
576
|
1 |
0 |
unless $beg & 1 |
|
577
|
0 |
1 |
if ref $end ne 'Math::BigInt' and $end == 18446744073709551615 |
|
586
|
0 |
2 |
if &_get_forexit() |
|
589
|
0 |
5 |
if &_get_forexit() |
|
606
|
0 |
16 |
if &_get_forexit() |
|
614
|
0 |
5 |
unless ref $iref eq 'ARRAY' |
|
632
|
2 |
24 |
unless defined $start |
|
633
|
1 |
22 |
unless &_validate_num($start) |
|
634
|
21 |
2 |
$start > 0 ? : |
|
638
|
22 |
1 |
if (ref $p ne 'Math::BigInt' and $p <= $_XS_MAXVAL) { } |
|
|
0 |
1 |
elsif ($_HAVE_GMP) { } |
|
643
|
22 |
66 |
if (scalar @$pr == 0) |
|
645
|
0 |
22 |
if $p >= 18446744073709551557 |
|
647
|
18 |
4 |
$p <= 10000 ? : |
|
648
|
0 |
22 |
if $p + $segment > 18446744073709551615 and $p + 1 < 18446744073709551615 |
|
676
|
1 |
0 |
if (defined $high) { } |
|
677
|
1 |
0 |
unless &_validate_num($low) |
|
678
|
1 |
0 |
unless &_validate_num($high) |
|
681
|
0 |
0 |
unless &_validate_num($high) |
|
683
|
0 |
1 |
if $high < 2 or $low > $high |
|
686
|
0 |
0 |
if $_HAVE_GMP and defined &Math::Prime::Util::GMP::prime_count and ref $high eq 'Math::BigInt' || $high - $low < int $low / 1000000 |
|
697
|
26 |
0 |
unless &_validate_num($n) |
|
699
|
0 |
26 |
if ($_HAVE_GMP) |
|
701
|
0 |
0 |
if ($n != 1) |
|
706
|
0 |
0 |
if (ref $_[0]) |
|
707
|
0 |
0 |
$_ > 18446744073709551615 ? : |
|
719
|
13 |
0 |
unless &_validate_num($n) |
|
723
|
0 |
13 |
unless wantarray |
|
731
|
0 |
0 |
$b % 4 == 3 ? : |
|
|
0 |
0 |
if $a == 0 |
|
732
|
0 |
0 |
$a % 4 == 3 ? : |
|
|
0 |
0 |
if $b == 0 |
|
748
|
0 |
125 |
if defined $n and $n < 2 |
|
749
|
11 |
114 |
unless &_validate_num($n) |
|
752
|
114 |
11 |
if ($n <= $_XS_MAXVAL) |
|
754
|
30 |
84 |
unless $isp == 2 |
|
758
|
0 |
11 |
if ($_HAVE_GMP and defined &Math::Prime::Util::GMP::is_provable_prime_with_cert) |
|
762
|
0 |
0 |
if (ref $cert ne 'ARRAY') |
|
774
|
0 |
11 |
if $isp == 0 |
|
775
|
0 |
11 |
if $isp == 2 |
|
794
|
0 |
11 |
unless $isp |
|
808
|
0 |
6 |
if $n <= 0 |
|
810
|
0 |
6 |
if $n > 10000000 |
|
813
|
6 |
0 |
if not defined $bignum::VERSION and ref $n ne 'Math::BigFloat' and $_Config{'xs'} |
|
821
|
2 |
9 |
if $n <= 0 |
|
824
|
9 |
0 |
if not defined $bignum::VERSION and ref $n ne 'Math::BigFloat' and $_Config{'xs'} |
|
832
|
1 |
22 |
if $n == 0 |
|
833
|
1 |
21 |
if $n == $_Neg_Infinity |
|
834
|
1 |
20 |
if $n == $_Infinity |
|
837
|
18 |
2 |
if not defined $bignum::VERSION and ref $n ne 'Math::BigFloat' and $_Config{'xs'} |
|
845
|
2 |
26 |
if $n == 0 |
|
846
|
1 |
25 |
if $n == 1 |
|
847
|
1 |
24 |
if $n == $_Infinity |
|
849
|
1 |
23 |
if $n <= 0 |
|
851
|
23 |
0 |
if (not defined $bignum::VERSION and ref $n ne 'Math::BigFloat' and $_Config{'xs'}) |
|
852
|
1 |
22 |
if $n == 2 |
|
864
|
9 |
0 |
if not defined $bignum::VERSION and ref $x ne 'Math::BigFloat' and $_Config{'xs'} |
|
874
|
0 |
116 |
if defined $n and $n < 0 |
|
875
|
0 |
116 |
unless &_validate_num($n) |
|
876
|
11 |
105 |
if $n > 1 and $n & 1 |
|
878
|
0 |
105 |
if ($Math::Prime::Util::_GMPfunc{'bernfrac'}) |
|
887
|
1 |
25 |
unless (defined $Math::BigFloat::VERSION) |
|
889
|
0 |
26 |
if ($Math::Prime::Util::_GMPfunc{'bernreal'}) |
|
890
|
0 |
0 |
unless defined $precision |
|
895
|
11 |
15 |
if $num->is_zero |
|
901
|
0 |
79 |
unless &_validate_num($n) |
|
902
|
0 |
79 |
if $n <= 0 |
|
904
|
0 |
79 |
if ($Math::Prime::Util::_GMPfunc{'harmfrac'}) |
|
913
|
0 |
22 |
unless &_validate_num($n) |
|
914
|
0 |
22 |
unless (defined $Math::BigFloat::VERSION) |
|
915
|
1 |
21 |
if $n <= 0 |
|
917
|
0 |
21 |
if ($Math::Prime::Util::_GMPfunc{'harmreal'}) |
|
918
|
0 |
0 |
unless defined $precision |
|
923
|
0 |
21 |
if (defined $precision and $precision <= 13) |
|
925
|
0 |
0 |
$n < 80 ? : |
|
931
|
0 |
21 |
if ($Math::Prime::Util::_GMPfunc{'harmfrac'}) |