Changeset 642e65 in git for kernel/F5cData.cc
- Timestamp:
- Jul 7, 2009, 8:54:56 PM (14 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- ab3db62fd566bf974e5dcf6da2405b18b464b0c4
- Parents:
- e9f5b23f3e4572bcb33e40a8f5debc2ca9bd11a6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/F5cData.cc
re9f5b2 r642e65 1 /*! 2 * \file F5cData.cc 3 * \author Christian Eder 4 * \brief This file includes the inlined methods of the classes CPair and Rule. 5 * \details This file include the inlined methods of the class CPair, 6 * representing critical pairs in the F5C Algorithm, and the class Rule, 7 * representing the labels in the F5C Algorithm. In this file the handling of 8 * these data types is defined. 9 */ 10 1 11 #include "mod2.h" 2 12 … … 18 28 #include "F5cData.h" 19 29 #include "F5cLists.h" 30 20 31 /* 21 ===================== 22 everything is inlined 23 ===================== 24 */ 32 * CONSTRUCTOR / DESTRUCTOR of class Label 33 */ 34 35 Label::Label(int* expVec) 36 { 37 m_pExpVec = expVec; 38 m_nShortExpVec = computeShortExpVec(m_pExpVec); 39 } 40 41 Label::~Label() 42 { 43 delete &m_nShortExpVec; 44 delete [] m_pExpVec; 45 } 46 47 /* 48 * GETTER of class Label 49 */ 50 inline int* Label::getExpVec() 51 { 52 return m_pExpVec; 53 } 54 55 inline unsigned long Label::getShortExpVec() 56 { 57 return m_nShortExpVec; 58 } 59 60 /* 61 * SETTER of class Label 62 */ 63 64 65 /* 66 * MISC of class Label 67 */ 68 inline unsigned long Label::computeShortExpVec(int* expVec) 69 { 70 //if (p == NULL) return 0; 71 unsigned long ev = 0; // short exponent vector 72 unsigned int n = BIT_SIZEOF_LONG / currRing->N; // number of bits per exp 73 unsigned int m1; // highest bit which is filled with (n+1) 74 unsigned int i = 0, j=1; 75 76 if (n == 0) 77 { 78 if (currRing->N <2*BIT_SIZEOF_LONG) 79 { 80 n=1; 81 m1=0; 82 } 83 else 84 { 85 for (; j<=(unsigned long) currRing->N; j++) 86 { 87 if (expVec[j] > 0) i++; 88 if (i == BIT_SIZEOF_LONG) break; 89 } 90 if (i>0) 91 ev = ~((unsigned long)0) >> ((unsigned long) (BIT_SIZEOF_LONG - i)); 92 return ev; 93 } 94 } 95 else 96 { 97 m1 = (n+1)*(BIT_SIZEOF_LONG - n*currRing->N); 98 } 99 100 n++; 101 while (i<m1) 102 { 103 ev |= getBitFields(expVec[j], i, n); 104 i += n; 105 j++; 106 } 107 108 n--; 109 while (i<BIT_SIZEOF_LONG) 110 { 111 ev |= getBitFields(expVec[j], i, n); 112 i += n; 113 j++; 114 } 115 return ev; 116 } 117 118 inline unsigned long Label::getBitFields(int e, unsigned int s, unsigned int n) 119 { 120 #define Sy_bit_L(x) (((unsigned long)1L)<<(x)) 121 unsigned int i = 0; 122 unsigned long ev = 0L; 123 assume(n > 0 && s < BIT_SIZEOF_LONG); 124 do 125 { 126 assume(s+i < BIT_SIZEOF_LONG); 127 if (e > (int) i) ev |= Sy_bit_L(s+i); 128 else break; 129 i++; 130 } 131 while (i < n); 132 return ev; 133 } 134 135 136 25 137 #endif 26 // HAVE_F5 c138 // HAVE_F5C
Note: See TracChangeset
for help on using the changeset viewer.