version 1.1.1.1, 2000/09/09 14:12:16 |
version 1.1.1.2, 2003/08/25 16:06:00 |
|
|
/* gmp_randclear (state) -- Clear and deallocate random state STATE. |
/* gmp_randclear (state) -- Clear and deallocate random state STATE. |
|
|
Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
Copyright 1999, 2000, 2001 Free Software Foundation, Inc. |
|
|
This file is part of the GNU MP Library. |
This file is part of the GNU MP Library. |
|
|
Line 23 MA 02111-1307, USA. */ |
|
Line 23 MA 02111-1307, USA. */ |
|
#include "gmp-impl.h" |
#include "gmp-impl.h" |
|
|
void |
void |
#if __STDC__ |
|
gmp_randclear (gmp_randstate_t rstate) |
gmp_randclear (gmp_randstate_t rstate) |
#else |
|
gmp_randclear (rstate) |
|
gmp_randstate_t rstate; |
|
#endif |
|
{ |
{ |
mpz_clear (rstate->seed); |
mpz_clear (rstate->_mp_seed); |
|
|
switch (rstate->alg) |
switch (rstate->_mp_alg) |
{ |
{ |
case GMP_RAND_ALG_LC: |
case GMP_RAND_ALG_LC: |
mpz_clear (rstate->algdata.lc->a); |
mpz_clear (rstate->_mp_algdata._mp_lc->_mp_a); |
if (rstate->algdata.lc->m2exp == 0) |
if (rstate->_mp_algdata._mp_lc->_mp_m2exp == 0) |
mpz_clear (rstate->algdata.lc->m); |
mpz_clear (rstate->_mp_algdata._mp_lc->_mp_m); |
(*_mp_free_func) (rstate->algdata.lc, sizeof (*rstate->algdata.lc)); |
(*__gmp_free_func) (rstate->_mp_algdata._mp_lc, sizeof (*rstate->_mp_algdata._mp_lc)); |
break; |
break; |
|
|
#if 0 |
#if 0 |
case GMP_RAND_ALG_BBS: |
case GMP_RAND_ALG_BBS: |
mpz_clear (rstate->algdata.bbs->bi); |
mpz_clear (rstate->algdata.bbs->bi); |
(*_mp_free_func) (rstate->algdata.bbs, sizeof (*rstate->algdata.bbs)); |
(*__gmp_free_func) (rstate->algdata.bbs, sizeof (*rstate->algdata.bbs)); |
break; |
break; |
#endif /* 0 */ |
#endif /* 0 */ |
|
|
default: |
default: |
gmp_errno |= GMP_ERROR_UNSUPPORTED_ARGUMENT; |
ASSERT (0); |
|
break; |
} |
} |
} |
} |