[BACK]Return to init.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / engine

Diff for /OpenXM_contrib2/asir2000/engine/init.c between version 1.10 and 1.11

version 1.10, 2001/03/13 01:10:25 version 1.11, 2001/06/07 04:54:40
Line 45 
Line 45 
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
  *   *
  * $OpenXM: OpenXM_contrib2/asir2000/engine/init.c,v 1.9 2001/03/08 07:49:12 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2000/engine/init.c,v 1.10 2001/03/13 01:10:25 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "version.h"  #include "version.h"
   #include "prime.h"
   
 struct oN oUNIN,oTWON,oTHREEN,oFOURN,oFIVEN,oSIXN,oSEVENN,oEIGHTN;  struct oN oUNIN,oTWON,oTHREEN,oFOURN,oFIVEN,oSIXN,oSEVENN,oEIGHTN;
 struct oQ oUNIQ,oTWOQ,oTHREEQ,oFOURQ,oFIVEQ,oSIXQ,oSEVENQ,oEIGHTQ;  struct oQ oUNIQ,oTWOQ,oTHREEQ,oFOURQ,oFIVEQ,oSIXQ,oSEVENQ,oEIGHTQ;
Line 83  int bigfloat;
Line 84  int bigfloat;
 int nez = 1;  int nez = 1;
 int current_mod = 0;  int current_mod = 0;
   
   static int *lprime;
   int lprime_size;
   
 #if PARI  #if PARI
 int paristack = 1<<16;  int paristack = 1<<16;
 #define ADDBF addbf  #define ADDBF addbf
Line 122  int (*cmpnumt[])() = { cmpq, cmpreal, cmpalg, CMPBF, c
Line 126  int (*cmpnumt[])() = { cmpq, cmpreal, cmpalg, CMPBF, c
 #endif  #endif
   
 double get_current_time();  double get_current_time();
   void init_lprime();
   
 void nglob_init() {  void nglob_init() {
         PL(&oUNIN) = 1; BD(&oUNIN)[0] = 1;          PL(&oUNIN) = 1; BD(&oUNIN)[0] = 1;
Line 178  void nglob_init() {
Line 183  void nglob_init() {
         srandom((int)get_current_time());          srandom((int)get_current_time());
 #endif  #endif
         init_up2_tab();          init_up2_tab();
   
           init_lprime();
 }  }
   
 extern double gctime;  extern double gctime;
Line 274  void create_error(ERR *err,unsigned int serial,char *m
Line 281  void create_error(ERR *err,unsigned int serial,char *m
         MKSTR(errmsg,msg1);          MKSTR(errmsg,msg1);
         MKNODE(n1,errmsg,0); MKNODE(n,ui,n1); MKLIST(list,n);          MKNODE(n1,errmsg,0); MKNODE(n,ui,n1); MKLIST(list,n);
         MKERR(*err,list);          MKERR(*err,list);
   }
   
   void init_lprime()
   {
           int s,i;
   
           s = sizeof(lprime_init);
           lprime = (int *)GC_malloc_atomic(s);
           lprime_size = s/sizeof(int);
           for ( i = 0; i < lprime_size; i++ )
                   lprime[i] = lprime_init[lprime_size-i-1];
   }
   
   void create_new_lprimes(int);
   
   int get_lprime(index)
   {
           if ( index >= lprime_size )
                   create_new_lprimes(index);
           return lprime[index];
   }
   
   void create_new_lprimes(index)
   int index;
   {
           int count,p,i,j,d;
   
           if ( index < lprime_size )
                   return;
           count = index-lprime_size+1;
           if ( count < 256 )
                   count = 256;
           lprime = (int *)GC_realloc(lprime,(lprime_size+count)*sizeof(int));
           p = lprime[lprime_size-1]+2;
           for ( i = 0; i < count; p += 2 ) {
                   for ( j = 0; d = sprime[j]; j++ ) {
                           if ( d*d > p ) {
                                   lprime[i+lprime_size] = p;
                                   i++;
                                   break;
                           }
                           if ( !(p%d) )
                                   break;
                   }
           }
           lprime_size += count;
 }  }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

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