[BACK]Return to randlc2x.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp

Diff for /OpenXM_contrib/gmp/Attic/randlc2x.c between version 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2000/09/09 14:12:16 version 1.1.1.2, 2003/08/25 16:06:00
Line 2 
Line 2 
    state STATE for a linear congruential generator with multiplier A,     state STATE for a linear congruential generator with multiplier A,
    adder C, and modulus 2 ^ M2EXP.     adder C, and modulus 2 ^ M2EXP.
   
 Copyright (C) 2000  Free Software Foundation, Inc.  Copyright 2000, 2002 Free Software Foundation, Inc.
   
 This file is part of the GNU MP Library.  This file is part of the GNU MP Library.
   
Line 25  MA 02111-1307, USA. */
Line 25  MA 02111-1307, USA. */
 #include "gmp-impl.h"  #include "gmp-impl.h"
   
 void  void
 #if __STDC__  
 gmp_randinit_lc_2exp (gmp_randstate_t rstate,  gmp_randinit_lc_2exp (gmp_randstate_t rstate,
                       mpz_t a,                        mpz_srcptr a,
                       unsigned long int c,                        unsigned long int c,
                       unsigned long int m2exp)                        unsigned long int m2exp)
 #else  
 gmp_randinit_lc_2exp (rstate, a, c, m2exp)  
      gmp_randstate_t rstate;  
      mpz_t a;  
      unsigned long int c;  
      unsigned long int m2exp;  
 #endif  
 {  {
   mpz_init_set_ui (rstate->seed, 1);    mpz_init_set_ui (rstate->_mp_seed, 1);
   _mpz_realloc (rstate->seed, m2exp / BITS_PER_MP_LIMB    _mpz_realloc (rstate->_mp_seed, (m2exp + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS);
                 + (m2exp % BITS_PER_MP_LIMB != 0));  
   
   /* Allocate algorithm specific data. */    /* Allocate algorithm specific data. */
   rstate->algdata.lc = (__gmp_randata_lc *)    rstate->_mp_algdata._mp_lc = (__gmp_randata_lc *)
     (*_mp_allocate_func) (sizeof (__gmp_randata_lc));      (*__gmp_allocate_func) (sizeof (__gmp_randata_lc));
   
   mpz_init_set (rstate->algdata.lc->a, a);    mpz_init_set (rstate->_mp_algdata._mp_lc->_mp_a, a);
   rstate->algdata.lc->c = c;    rstate->_mp_algdata._mp_lc->_mp_c = c;
   
   /* Cover weird case where m2exp is 0, which means that m is used    /* Cover weird case where m2exp is 0, which means that m is used
      instead of m2exp.  */       instead of m2exp.  */
   if (m2exp == 0)    if (m2exp == 0)
     mpz_init_set_ui (rstate->algdata.lc->m, 0);      mpz_init_set_ui (rstate->_mp_algdata._mp_lc->_mp_m, 0);
   rstate->algdata.lc->m2exp = m2exp;    rstate->_mp_algdata._mp_lc->_mp_m2exp = m2exp;
   
   rstate->alg = GMP_RAND_ALG_LC;    rstate->_mp_alg = GMP_RAND_ALG_LC;
 }  }

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>