=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/engine/nd.c,v retrieving revision 1.34 retrieving revision 1.36 diff -u -p -r1.34 -r1.36 --- OpenXM_contrib2/asir2000/engine/nd.c 2003/08/20 06:06:07 1.34 +++ OpenXM_contrib2/asir2000/engine/nd.c 2003/08/20 07:55:45 1.36 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.33 2003/08/19 05:29:11 noro Exp $ */ +/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.35 2003/08/20 07:04:31 noro Exp $ */ #include "ca.h" #include "inline.h" @@ -288,7 +288,7 @@ INLINE int nd_length(ND p) } } -int ndl_reducible(unsigned int *d1,unsigned int *d2) +INLINE int ndl_reducible(unsigned int *d1,unsigned int *d2) { unsigned int u1,u2; int i,j; @@ -372,7 +372,7 @@ void ndl_dehomogenize(unsigned int *d) h = (d[1]>>((nd_epw-1)*nd_bpe))&nd_mask0; for ( i = 1; i <= nd_wpd; i++ ) d[i] = ((d[i]<>((nd_epw-1)*nd_bpe))&nd_mask0):0); + |(i+1<=nd_wpd?((d[i+1]>>((nd_epw-1)*nd_bpe))&nd_mask0):0); TD(d) -= h; } } else @@ -505,12 +505,11 @@ INLINE void ndl_copy(unsigned int *d1,unsigned int *d2 } } -/* XXX : TD is not added */ - INLINE void ndl_add(unsigned int *d1,unsigned int *d2,unsigned int *d) { int i; + TD(d) = TD(d1)+TD(d2); switch ( nd_wpd ) { case 1: d[1] = d1[1]+d2[1]; @@ -2078,7 +2077,7 @@ void dltondl(int n,DL dl,unsigned int *r) int i; d = dl->d; - bzero(r,(nd_wpd+1)*sizeof(unsigned int)); + for ( i = 0; i <= nd_wpd; i++ ) r[i] = 0; if ( nd_isrlex ) for ( i = 0; i < n; i++ ) r[(n-1-i)/nd_epw+1] |= (d[i]<<((nd_epw-((n-1-i)%nd_epw)-1)*nd_bpe)); @@ -2409,7 +2408,8 @@ unsigned int *dp_compute_bound(DP p) d1 = (unsigned int *)ALLOCA(nd_nvar*sizeof(unsigned int)); d2 = (unsigned int *)ALLOCA(nd_nvar*sizeof(unsigned int)); m = BDY(p); - bcopy(DL(m)->d,d1,nd_nvar*sizeof(unsigned int)); + d = DL(m)->d; + for ( i = 0; i < nd_nvar; i++ ) d1[i] = d[i]; for ( m = NEXT(BDY(p)); m; m = NEXT(m) ) { d = DL(m)->d; for ( i = 0; i < nd_nvar; i++ ) @@ -2418,8 +2418,8 @@ unsigned int *dp_compute_bound(DP p) } l = (nd_nvar+31); t = (unsigned int *)MALLOC_ATOMIC(l*sizeof(unsigned int)); - bzero(t,l*sizeof(unsigned int)); - bcopy(d1,t,nd_nvar*sizeof(unsigned int)); + for ( i = 0; i < nd_nvar; i++ ) t[i] = d1[i]; + for ( ; i < l; i++ ) t[i] = 0; return t; } @@ -2433,16 +2433,17 @@ unsigned int *nd_compute_bound(ND p) return 0; d1 = (unsigned int *)ALLOCA(nd_wpd*sizeof(unsigned int)); d2 = (unsigned int *)ALLOCA(nd_wpd*sizeof(unsigned int)); - bcopy(HDL(p),d1,nd_wpd*sizeof(unsigned int)); + ndl_copy(HDL(p),d1); for ( m = NEXT(BDY(p)); m; m = NEXT(m) ) { ndl_lcm(DL(m),d1,d2); t = d1; d1 = d2; d2 = t; } l = nd_nvar+31; t = (unsigned int *)MALLOC_ATOMIC(l*sizeof(unsigned int)); - bzero(t,l*sizeof(unsigned int)); + for ( i = 0; i < l; i++ ) t[i] = 0; for ( i = 0; i < nd_nvar; i++ ) t[i] = (d1[i/nd_epw+1]>>((nd_epw-(i%nd_epw)-1)*nd_bpe))&nd_mask0; + for ( ; i < l; i++ ) t[i] = 0; return t; } @@ -2704,7 +2705,6 @@ ND ndv_mul_nm(int mod,NDV p,NM m0) c1 = CM(m); DMAR(c1,c,0,mod,c2); CM(mr) = c2; - TD(DL(mr)) = TD(DL(m))+td; ndl_add(DL(m),d,DL(mr)); } } else { @@ -2712,7 +2712,6 @@ ND ndv_mul_nm(int mod,NDV p,NM m0) for ( i = 0; i < len; i++, NMV_ADV(m) ) { NEXTNM(mr0,mr); mulq(CQ(m),q,&CQ(mr)); - TD(DL(mr)) = TD(DL(m))+td; ndl_add(DL(m),d,DL(mr)); } }