source: git/Singular/pInline0.h @ a6a239

spielwiese
Last change on this file since a6a239 was a6a239, checked in by Olaf Bachmann <obachman@…>, 24 years ago
* new implementation of polys git-svn-id: file:///usr/local/Singular/svn/trunk@4580 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/***************************************************************
5 *  File:    pInline.cc
6 *  Purpose: implementation of poly Level 0 functions
7 *  Author:  obachman (Olaf Bachmann)
8 *  Created: 8/00
9 *  Version: $Id: pInline0.h,v 1.1 2000-09-12 16:01:04 obachman Exp $
10 *******************************************************************/
11#ifndef PINLINE0_H
12#define PINLINE0_H
13
14#if defined(DO_PINLINE0)
15#define PINLINE0 static inline
16#else
17#define PINLINE0
18#endif
19
20#include "mod2.h"
21#include "polys.h"
22 
23PINLINE0 void p_SetCompP(poly p, int i, ring r)
24{
25  while (p != NULL)
26  {
27    p_SetComp(p, i, r);
28    p_SetmComp(p, r);
29    pIter(p);
30  }
31}
32
33PINLINE0 void p_SetCompP(poly p, int i, ring lmRing, ring tailRing)
34{
35  if (p != NULL)
36  {
37    p_SetComp(p, i, lmRing);
38    p_SetmComp(p, lmRing);
39    p_SetCompP(pNext(p), i, tailRing);
40  }
41}
42
43PINLINE0 poly pReverse(poly p)
44{
45  if (p == NULL || pNext(p) == NULL) return p;
46
47  poly q = pNext(p), // == pNext(p)
48    qn;
49  pNext(p) = NULL;
50  do
51  {
52    qn = pNext(q);
53    pNext(q) = p;
54    p = q;
55    q = qn;
56  }
57  while (qn != NULL);
58  return p;
59}
60
61#endif // PINLINE_CC
62
Note: See TracBrowser for help on using the repository browser.