Changeset a527a41 in git
- Timestamp:
- Jul 9, 2018, 2:39:53 PM (5 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 43fa86cc32c42433e618d6c2978915bf8a580e66
- Parents:
- ac754db5ea554de8a6115ff7e914fb77dc57c434
- Location:
- libpolys/coeffs
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/coeffs/ffields.cc
rac754d ra527a41 499 499 * read an integer (with reduction mod p) 500 500 */ 501 static const char* nfEati(const char *s, int *i, const coeffs r) 502 { 503 if (*s >= '0' && *s <= '9') 504 { 505 *i = 0; 506 do 507 { 508 *i *= 10; 509 *i += *s++ - '0'; 510 if (*i > (MAX_INT_VAL / 10)) *i = *i % r->m_nfCharP; 511 } 512 while (*s >= '0' && *s <= '9'); 513 if (*i >= r->m_nfCharP) *i = *i % r->m_nfCharP; 514 } 515 else *i = 1; 516 return s; 501 static inline const char* nfEati(const char *s, int *i, const coeffs r) 502 { 503 return nEati((char *)s,i,r->m_nfCharP); 517 504 } 518 505 -
libpolys/coeffs/flintcf_Q.cc
rac754d ra527a41 44 44 return s; 45 45 } 46 47 static const char* Eati(const char *s, int *i)48 {49 50 if (((*s) >= '0') && ((*s) <= '9'))51 {52 unsigned long ii=0L;53 do54 {55 ii *= 10;56 ii += *s++ - '0';57 }58 while (((*s) >= '0') && ((*s) <= '9'));59 *i=(int)ii;60 }61 else (*i) = 1;62 return s;63 }64 65 66 46 67 47 static void CoeffWrite(const coeffs r, BOOLEAN details) … … 303 283 // we only read "monomials" (i.e. [-][digits][parameter]), 304 284 // everythings else (+,*,^,()) is left to the singular interpreter 305 c onst char *s=st;285 char *s=(char *)st; 306 286 *a=(number)omAlloc(sizeof(fmpq_poly_t)); 307 287 fmpq_poly_init((fmpq_poly_ptr)(*a)); … … 329 309 { 330 310 int i=1; 331 s= Eati(s,&i);311 s=nEati(s,&i,0); 332 312 if (i!=1) 333 313 { -
libpolys/coeffs/longrat0.cc
rac754d ra527a41 28 28 29 29 /*2 30 * extracts a long integer from s, returns the rest31 */32 const char * nlEatLong(char *s, mpz_ptr i)33 {34 const char * start=s;35 36 while (*s >= '0' && *s <= '9') s++;37 if (*s=='\0')38 {39 mpz_set_str(i,start,10);40 }41 else42 {43 char c=*s;44 *s='\0';45 mpz_set_str(i,start,10);46 *s=c;47 }48 return s;49 }50 51 /*252 30 * extracts the number a from s, returns the rest 53 31 */ … … 68 46 mpz_ptr n=(*a)->n; 69 47 mpz_init(z); 70 s = n lEatLong((char *)s, z);48 s = nEatLong((char *)s, z); 71 49 if (*s == '/') 72 50 { … … 74 52 (*a)->s = 0; 75 53 s++; 76 s = n lEatLong((char *)s, n);54 s = nEatLong((char *)s, n); 77 55 if (mpz_cmp_si(n,0L)==0) 78 56 { -
libpolys/coeffs/modulop.cc
rac754d ra527a41 264 264 #endif 265 265 266 static const char* npEati(const char *s, int *i, const coeffs r) 267 { 268 if (((*s) >= '0') && ((*s) <= '9')) 269 { 270 unsigned long ii=0L; 271 do 272 { 273 ii *= 10; 274 ii += *s++ - '0'; 275 if (ii >= (MAX_INT_VAL / 10)) ii = ii % r->ch; 276 } 277 while (((*s) >= '0') && ((*s) <= '9')); 278 if (ii >= (unsigned long)r->ch) ii = ii % r->ch; 279 *i=(int)ii; 280 } 281 else (*i) = 1; 282 return s; 266 static inline const char* npEati(const char *s, int *i, const coeffs r) 267 { 268 return nEati((char *)s,i,r->ch); 283 269 } 284 270 -
libpolys/coeffs/numbers.cc
rac754d ra527a41 598 598 CanonicalForm n_convSingNFactoryN( number n, BOOLEAN setChar, const coeffs r ) 599 599 { STATISTIC(n_convSingNFactoryN); assume(r != NULL); assume(r->convSingNFactoryN != NULL); return r->convSingNFactoryN(n, setChar, r); } 600 601 602 char* nEati(char *s, int *i, int m) 603 { 604 605 if (((*s) >= '0') && ((*s) <= '9')) 606 { 607 unsigned long ii=0L; 608 do 609 { 610 ii *= 10; 611 ii += *s++ - '0'; 612 if ((m!=0) && (ii>m)) ii=ii%m; 613 } 614 while (((*s) >= '0') && ((*s) <= '9')); 615 if ((m!=0) && (ii>m)) ii=ii%m; 616 *i=(int)ii; 617 } 618 else (*i) = 1; 619 return s; 620 } 621 622 /// extracts a long integer from s, returns the rest 623 char * nEatLong(char *s, mpz_ptr i) 624 { 625 const char * start=s; 626 627 while (*s >= '0' && *s <= '9') s++; 628 if (*s=='\0') 629 { 630 mpz_set_str(i,start,10); 631 } 632 else 633 { 634 char c=*s; 635 *s='\0'; 636 mpz_set_str(i,start,10); 637 *s=c; 638 } 639 return s; 640 } 641 -
libpolys/coeffs/numbers.h
rac754d ra527a41 105 105 // void ndClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, number& d, const coeffs r); 106 106 107 /// helper routine: read an int from a string (mod m), return a pointer to the rest 108 char* nEati(char *s, int *i, int m); 109 110 /// extracts a long integer from s, returns the rest 111 char * nEatLong(char *s, mpz_ptr i); 107 112 #endif
Note: See TracChangeset
for help on using the changeset viewer.