1 /*
2 
3 Copyright 2011, 2018 Free Software Foundation, Inc.
4 
5 This file is part of the GNU MP Library test suite.
6 
7 The GNU MP Library test suite is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 3 of the License,
10 or (at your option) any later version.
11 
12 The GNU MP Library test suite is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
15 Public License for more details.
16 
17 You should have received a copy of the GNU General Public License along with
18 the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */
19 
20 enum hex_random_op
21   {
22     OP_ADD, OP_SUB, OP_MUL, OP_SQR,
23     OP_CDIV, OP_FDIV, OP_TDIV,
24     OP_CDIV_Q_2, OP_CDIV_R_2,
25     OP_FDIV_Q_2, OP_FDIV_R_2,
26     OP_TDIV_Q_2,  OP_TDIV_R_2,
27     OP_GCD, OP_LCM, OP_POWM, OP_AND, OP_IOR, OP_XOR,
28     OP_SETBIT, OP_CLRBIT, OP_COMBIT,
29     OP_SCAN0, OP_SCAN1
30   };
31 
32 void hex_random_init (void);
33 char *hex_urandomb (unsigned long bits);
34 char *hex_rrandomb (unsigned long bits);
35 char *hex_rrandomb_export (void *dst, size_t *countp,
36 			   int order, size_t size, int endian,
37 			   unsigned long bits);
38 
39 void hex_random_op2 (enum hex_random_op op,  unsigned long maxbits,
40 		     char **ap, char **rp);
41 void hex_random_op3 (enum hex_random_op op,  unsigned long maxbits,
42 		     char **ap, char **bp, char **rp);
43 void hex_random_op4 (enum hex_random_op op,  unsigned long maxbits,
44 		     char **ap, char **bp, char **rp, char **qp);
45 void hex_random_bit_op (enum hex_random_op op, unsigned long maxbits,
46 			char **ap, unsigned long *b, char **rp);
47 void hex_random_scan_op (enum hex_random_op op, unsigned long maxbits,
48 			char **ap, unsigned long *b, unsigned long *r);
49 void hex_random_str_op (unsigned long maxbits,
50 			int base, char **ap, char **rp);
51 void hex_random_lucm_op (unsigned long maxbits,
52 			 char **vp, char **qp, char **mp,
53 			 long *Q, unsigned long *b0, int *res);
54 void hex_mpq_random_str_op (unsigned long maxbits,
55 			    int base, char **ap, char **rp);
56