PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 3.1.0
Defender Security – Malware Scanner, Login Security & Firewall v3.1.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / vendor / thecodingmachine / safe / generated / gmp.php

gmp.php in Defender Security – Malware Scanner, Login Security & Firewall 3.1.0, at vendor/thecodingmachine/safe/generated/gmp.php

88 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Safe;
4
5 use Safe\Exceptions\GmpException;
6
7 /**
8 * Calculates the binomial coefficient C(n, k).
9 *
10 * @param \GMP|string|int $n Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric string provided that it is possible to convert the latter to a number.
11 * @param int $k
12 * @return \GMP Returns the binomial coefficient C(n, k).
13 * @throws GmpException
14 *
15 */
16 function gmp_binomial($n, int $k): \GMP
17 {
18 error_clear_last();
19 $result = \gmp_binomial($n, $k);
20 if ($result === false) {
21 throw GmpException::createFromPhpError();
22 }
23 return $result;
24 }
25
26
27 /**
28 * Export a GMP number to a binary string
29 *
30 * @param \GMP|string|int $gmpnumber The GMP number being exported
31 * @param int $word_size Default value is 1. The number of bytes in each chunk of binary data. This is mainly used in conjunction with the options parameter.
32 * @param int $options Default value is GMP_MSW_FIRST | GMP_NATIVE_ENDIAN.
33 * @return string Returns a string.
34 * @throws GmpException
35 *
36 */
37 function gmp_export($gmpnumber, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): string
38 {
39 error_clear_last();
40 $result = \gmp_export($gmpnumber, $word_size, $options);
41 if ($result === false) {
42 throw GmpException::createFromPhpError();
43 }
44 return $result;
45 }
46
47
48 /**
49 * Import a GMP number from a binary string
50 *
51 * @param string $data The binary string being imported
52 * @param int $word_size Default value is 1. The number of bytes in each chunk of binary data. This is mainly used in conjunction with the options parameter.
53 * @param int $options Default value is GMP_MSW_FIRST | GMP_NATIVE_ENDIAN.
54 * @return \GMP Returns a GMP number.
55 * @throws GmpException
56 *
57 */
58 function gmp_import(string $data, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): \GMP
59 {
60 error_clear_last();
61 $result = \gmp_import($data, $word_size, $options);
62 if ($result === false) {
63 throw GmpException::createFromPhpError();
64 }
65 return $result;
66 }
67
68
69 /**
70 *
71 *
72 * @param \GMP|string|int $seed The seed to be set for the gmp_random,
73 * gmp_random_bits, and
74 * gmp_random_range functions.
75 *
76 * Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric string provided that it is possible to convert the latter to a number.
77 * @throws GmpException
78 *
79 */
80 function gmp_random_seed($seed): void
81 {
82 error_clear_last();
83 $result = \gmp_random_seed($seed);
84 if ($result === false) {
85 throw GmpException::createFromPhpError();
86 }
87 }
88