Changeset 2eeb7d in git


Ignore:
Timestamp:
Jul 13, 1999, 6:24:45 PM (25 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
eff050869a8899bcdec83ae6d17706325400e93d
Parents:
e202148165f594419822417d29c7ed3dac92e205
Message:
*hannes: minor optimizations


git-svn-id: file:///usr/local/Singular/svn/trunk@3266 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    re20214 r2eeb7d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: iparith.cc,v 1.160 1999-07-12 18:24:57 Singular Exp $ */
     4/* $Id: iparith.cc,v 1.161 1999-07-13 16:24:45 Singular Exp $ */
    55
    66/*
     
    57795779        break;
    57805780      }
    5781       else if (strcmp(n, cmds[en].name) == 0)
     5781      else if ((an!=en) && (strcmp(n, cmds[en].name) == 0))
    57825782      {
    57835783        i=en;
     
    57925792    if (*n < *(cmds[i].name))
    57935793    {
    5794       en=i;
     5794      en=i-1;
    57955795    }
    57965796    else if (*n > *(cmds[i].name))
    57975797    {
    5798       an=i;
     5798      an=i+1;
    57995799    }
    58005800    else
     
    58035803      if(v<0)
    58045804      {
    5805         en=i;
     5805        en=i-1;
    58065806      }
    58075807      else if(v>0)
    58085808      {
    5809         an=i;
     5809        an=i+1;
    58105810      }
    58115811      else /*v==0*/
  • Singular/ipshell.cc

    re20214 r2eeb7d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ipshell.cc,v 1.43 1999-07-05 13:52:06 obachman Exp $ */
     4/* $Id: ipshell.cc,v 1.44 1999-07-13 16:24:44 Singular Exp $ */
    55/*
    66* ABSTRACT:
     
    3333#include "stairc.h"
    3434#include "ipshell.h"
     35#ifdef HAVE_FACTORY
     36#define SI_DONT_HAVE_GLOBAL_VARS
     37#include <factory.h>
     38#endif
    3539
    3640leftv iiCurrArgs=NULL;
     
    521525  else if (p <  0) return (-IsPrime(-p));
    522526  else if (!(p & 1)) return IsPrime(p-1);
     527#ifdef HAVE_FACTORY
     528  int a=0;
     529  int e=cf_getNumSmallPrimes();
     530  i=e/2;
     531  do
     532  {
     533    if (p==(j=cf_getSmallPrime(i))) return p;
     534    if (p<j) e=i-1;
     535    else     a=i+1;
     536    i=a+(e-a)/2;
     537  } while ( a<= e);
     538  if (p>j) return j;
     539  else     return cf_getSmallPrime(i-1);
     540#else 
    523541  for (j=p/2+1,i=3; i<p; i+=2)
    524542  {
     
    527545  }
    528546  return p;
     547#endif
    529548}
    530549
Note: See TracChangeset for help on using the changeset viewer.