Changeset 4b5b36 in git
- Timestamp:
- Jul 9, 2018, 3:45:56 PM (5 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- e5ddd4bbb0c30d53b6ebc1f1a4d963405f91c7f6
- Parents:
- 113a802e445da6c564286206f2eb02f93a3167a3
- Location:
- libpolys/coeffs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/coeffs/rintegers.cc
r113a80 r4b5b36 133 133 } 134 134 135 staticvoid nrzDelete(number *a, const coeffs)135 void nrzDelete(number *a, const coeffs) 136 136 { 137 137 if (*a != NULL) … … 158 158 #endif 159 159 160 staticint nrzSize(number a, const coeffs)160 int nrzSize(number a, const coeffs) 161 161 { 162 162 mpz_ptr p=(mpz_ptr)a; -
libpolys/coeffs/rintegers.h
r113a80 r4b5b36 26 26 27 27 void nrzWrite (number a, const coeffs r); /*for rmodulon.cc*/ 28 void nrzDelete (number *a, const coeffs); /*for rmodulon.cc*/ 29 int nrzSize (number a, const coeffs); /*for rmodulon.cc*/ 30 void nrzWriteFd(number n, const ssiInfo* d, const coeffs); /*for rmodulon.cc*/ 31 number nrzReadFd(const ssiInfo *d, const coeffs); /*for rmodulon.cc*/ 28 32 29 33 number nrzInit (long i, const coeffs r); /*for SAGE, better: n_Init*/ -
libpolys/coeffs/rmodulon.cc
r113a80 r4b5b36 15 15 #include "coeffs/coeffs.h" 16 16 #include "coeffs/modulop.h" 17 #include "coeffs/rintegers.h" 17 18 #include "coeffs/numbers.h" 18 19 … … 87 88 if(nrnCoeffName_buff!=NULL) omFree(nrnCoeffName_buff); 88 89 size_t l = (size_t)mpz_sizeinbase(r->modBase, 10) + 2; 89 nrnCoeffName_buff=(char*)omAlloc(l+12);90 90 char* s = (char*) omAlloc(l); 91 l+=22; 92 nrnCoeffName_buff=(char*)omAlloc(l); 91 93 s= mpz_get_str (s, 10, r->modBase); 94 int ll; 92 95 if (nCoeff_is_Ring_ModN(r)) 93 snprintf(nrnCoeffName_buff,l+6,"ZZ/bigint(%s)",s);96 ll=snprintf(nrnCoeffName_buff,l,"ZZ/bigint(%s)",s); 94 97 else if (nCoeff_is_Ring_PtoM(r)) 95 snprintf(nrnCoeffName_buff,l+6,"ZZ/bigint(%s)^%lu",s,r->modExponent); 96 omFreeSize((ADDRESS)s, l); 98 ll=snprintf(nrnCoeffName_buff,l,"ZZ/bigint(%s)^%lu",s,r->modExponent); 99 assume(ll<(int)l); // otherwise nrnCoeffName_buff too small 100 omFreeSize((ADDRESS)s, l-22); 97 101 return nrnCoeffName_buff; 98 102 } 99 100 103 101 104 static BOOLEAN nrnCoeffIsEqual(const coeffs r, n_coeffType n, void * parameter) … … 190 193 } 191 194 195 /* 196 * convert a number to int 197 */ 198 static long nrnInt(number &n, const coeffs) 199 { 200 return mpz_get_si((mpz_ptr) n); 201 } 202 203 #if SI_INTEGER_VARIANT==2 204 #define nrnDelete nrzDelete 205 #define nrnSize nrzSize 206 #else 192 207 static void nrnDelete(number *a, const coeffs) 193 208 { … … 199 214 } 200 215 } 201 202 216 static int nrnSize(number a, const coeffs) 203 217 { … … 207 221 return s; 208 222 } 209 210 /* 211 * convert a number to int 212 */ 213 static long nrnInt(number &n, const coeffs) 214 { 215 return mpz_get_si((mpz_ptr) n); 216 } 217 223 #endif 218 224 /* 219 225 * Multiply two numbers … … 1050 1056 r->cfKillChar = nrnKillChar; 1051 1057 r->cfQuot1 = nrnQuot1; 1058 #if SI_INTEGER_VARIANT==2 1059 r->cfWriteFd = nrzWriteFd; 1060 r->cfReadFd = nrzReadFd; 1061 #endif 1062 1052 1063 #ifdef LDEBUG 1053 1064 r->cfDBTest = nrnDBTest;
Note: See TracChangeset
for help on using the changeset viewer.