source: git/polys/templates/p_ShallowCopyDelete__T.cc @ 879cc3c

spielwiese
Last change on this file since 879cc3c was 879cc3c, checked in by Mohamed Barakat <mohamed.barakat@…>, 14 years ago
monmials: . data structures, allocation/deallocation, comparing monomials tests for monomials, Setm, Degree operations: . operations on polynomials as lists (e.g. length, Maps, Sort, ...) templates: . templates for inline procedures and code to generate them ext_fields: . quotient fields of polynomial rings and algebraic extensions
  • Property mode set to 100644
File size: 1.0 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/***************************************************************
5 *  File:    p_ShallowCopyDelete__Template.cc
6 *  Purpose: template for p_ShallowCopyDelete
7 *  Author:  obachman (Olaf Bachmann)
8 *  Created: 8/00
9 *  Version: $Id$
10 *******************************************************************/
11
12/***************************************************************
13 *
14 * Destroys: p
15 * Assumes:  Monoms of p are from
16 * Returns:
17 ***************************************************************/
18LINKAGE poly p_ShallowCopyDelete(poly s_p, const ring r, omBin d_bin)
19{
20  spolyrec dp;
21  poly d_p = &dp;
22  poly h;
23
24  DECLARE_LENGTH(const unsigned long length = r->ExpL_Size);
25
26  while (s_p != NULL)
27  {
28    p_AllocBin(d_p->next, d_bin, r);
29    pIter(d_p);
30    pSetCoeff0(d_p, pGetCoeff(s_p));
31    h = s_p;
32    s_p =  pNext(s_p);
33    p_MemCopy(d_p->exp, h->exp, length);
34    p_FreeBinAddr(h, r);
35  }
36  pNext(d_p) = NULL;
37  return dp.next;
38}
39
Note: See TracBrowser for help on using the repository browser.