Changeset 05bcd5 in git


Ignore:
Timestamp:
Jun 14, 1999, 6:35:34 PM (25 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
3c8e50bcc6eb720109f4b83d71567c36d48d8ae1
Parents:
07f20e1f2be7d445106e822d1dd8fdc8cac35e88
Message:
*hannes: avoid deep stack in large expr-lists


git-svn-id: file:///usr/local/Singular/svn/trunk@3129 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    r07f20e1 r05bcd5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: iparith.cc,v 1.150 1999-06-07 15:46:05 obachman Exp $ */
     4/* $Id: iparith.cc,v 1.151 1999-06-14 16:35:34 Singular Exp $ */
    55
    66/*
     
    618618    if (iiOp=='-')                  /* u==NULL, v<>NULL, iiOp=='-'*/
    619619    {
    620       if (res->next==NULL)
    621         res->next = (leftv)Alloc(sizeof(sleftv));
    622       return iiExprArith1(res->next,v,'-');
     620      do
     621      {
     622        if (res->next==NULL)
     623          res->next = (leftv)Alloc0(sizeof(sleftv));
     624        leftv tmp_v=v->next;
     625        v->next=NULL;
     626        BOOLEAN b=iiExprArith1(res->next,v,'-');
     627        v->next=tmp_v;
     628        if (b)
     629          return TRUE;
     630        v=tmp_v;
     631        res=res->next;
     632      } while (v!=NULL);
     633      return FALSE;
    623634    }
    624635    loop                            /* u==NULL, v<>NULL, iiOp=='+' */
     
    634645  if (v!=NULL)                     /* u<>NULL, v<>NULL */
    635646  {
    636     res->next = (leftv)Alloc(sizeof(sleftv));
    637     return iiExprArith2(res->next,u,iiOp,v);
     647    do
     648    {
     649      res->next = (leftv)Alloc0(sizeof(sleftv));
     650      leftv tmp_u=u->next; u->next=NULL;
     651      leftv tmp_v=v->next; v->next=NULL;
     652      BOOLEAN b=iiExprArith2(res->next,u,iiOp,v);
     653      u->next=tmp_u;
     654      v->next=tmp_v;
     655      if (b)
     656        return TRUE;
     657      u=tmp_u;
     658      v=tmp_v;
     659      res=res->next;
     660    } while ((u!=NULL) && (v!=NULL));
     661    return FALSE;
    638662  }
    639663  loop                             /* u<>NULL, v==NULL */
     
    38973921  intvec* arg = (intvec*) u->Data();
    38983922  int i, n = min(im->cols()*im->rows(), arg->cols()*arg->rows());
    3899  
     3923
    39003924  for (i=0; i<n; i++)
    39013925  {
    39023926    (*im)[i] = (*arg)[i];
    39033927  }
    3904  
     3928
    39053929  res->data = (char *)im;
    39063930  return FALSE;
     
    45794603    return FALSE;
    45804604  }
    4581  
     4605
    45824606  char** slist = (char**) Alloc(n*sizeof(char*));
    45834607  int i, j;
    4584  
     4608
    45854609  for (i=0, j=0; i<n; i++, v = v ->next)
    45864610  {
Note: See TracChangeset for help on using the changeset viewer.