Changeset 8c484e in git for coeffs/modulop.cc
- Timestamp:
- May 5, 2010, 3:05:12 PM (13 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 2336d0a674d92415a0e20e0b4abf6b1a96ab56e2
- Parents:
- 63c3a8df898418cfb9484633a8d9eb78c299a95c
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2010-05-05 15:05:12+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:51:39+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
coeffs/modulop.cc
r63c3a8 r8c484e 8 8 9 9 #include <string.h> 10 #include "config.h" 11 #include <omalloc.h> 10 12 #include "coeffs.h" 13 #include "output.h" 11 14 #include "numbers.h" 12 15 #include "longrat.h" 13 16 #include "mpr_complex.h" 17 #include "mylimits.h" 14 18 #include "modulop.h" 15 19 16 20 int npGen=0; 17 long npMapPrime;18 21 19 22 #ifdef HAVE_DIV_MOD … … 243 246 ii *= 10; 244 247 ii += *s++ - '0'; 245 if (ii >= (MAX_INT _VAL/ 10)) ii = ii % r->npPrimeM;248 if (ii >= (MAX_INT / 10)) ii = ii % r->npPrimeM; 246 249 } 247 250 while (((*s) >= '0') && ((*s) <= '9')); … … 304 307 } 305 308 306 void npInitChar(int c, coeffs r) 309 void npKillChar(coeffs r) 310 { 311 #ifdef HAVE_DIV_MOD 312 if (r->npInvTable!=NULL) 313 omFreeSize( (void *)r->npInvTable, r->npPrimeM*sizeof(unsigned short) ); 314 r->npInvTable=NULL; 315 #else 316 if (r->npExpTable!=NULL) 317 { 318 omFreeSize( (void *)r->npExpTable, r->npPrimeM*sizeof(unsigned short) ); 319 omFreeSize( (void *)r->npLogTable, r->npPrimeM*sizeof(unsigned short) ); 320 r->npExpTable=NULL; r->npLogTable=NULL; 321 } 322 #endif 323 } 324 325 void npInitChar(coeffs r, int c) 307 326 { 308 327 int i, w; … … 353 372 #endif 354 373 } 374 r->cfKillChar=npKillChar; 375 r->cfSetChar=NULL; 376 r->cfInit = npInit; 377 r->n_Int = npInt; 378 r->nAdd = npAdd; 379 r->nSub = npSub; 380 r->nMult = npMult; 381 r->nDiv = npDiv; 382 r->nExactDiv= npDiv; 383 r->nNeg = npNeg; 384 r->nInvers= npInvers; 385 r->cfCopy = ndCopy; 386 r->nGreater = npGreater; 387 r->nEqual = npEqual; 388 r->nIsZero = npIsZero; 389 r->nIsOne = npIsOne; 390 r->nIsMOne = npIsMOne; 391 r->nGreaterZero = npGreaterZero; 392 r->cfWrite = npWrite; 393 r->nRead = npRead; 394 r->nPower = npPower; 395 r->cfSetMap = npSetMap; 396 r->nName= ndName; 397 r->nSize = ndSize; 398 #ifdef LDEBUG 399 r->nDBTest=npDBTest; 400 #endif 401 #ifdef NV_OPS 402 if (c>NV_MAX_PRIME) 403 { 404 r->nMult = nvMult; 405 r->nDiv = nvDiv; 406 r->nExactDiv= nvDiv; 407 r->nInvers= nvInvers; 408 r->nPower= nvPower; 409 } 410 #endif 355 411 } 356 412 else … … 372 428 #endif 373 429 374 number npMap0(number from, const coeffs dst_r)430 number npMap0(number from, const coeffs src, const coeffs dst_r) 375 431 { 376 432 return npInit(nlModP(from,dst_r->npPrimeM),dst_r); 377 433 } 378 434 379 number npMapP(number from, const coeffs dst_r)435 number npMapP(number from, const coeffs src, const coeffs dst_r) 380 436 { 381 437 long i = (long)from; 382 if (i> npMapPrime/2)383 { 384 i-= npMapPrime;438 if (i>src->npPrimeM/2) 439 { 440 i-=src->npPrimeM; 385 441 while (i < 0) i+=dst_r->npPrimeM; 386 442 } … … 389 445 } 390 446 391 static number npMapLongR(number from, const coeffs dst_r)447 static number npMapLongR(number from, const coeffs src, const coeffs dst_r) 392 448 { 393 449 gmp_float *ff=(gmp_float*)from; … … 455 511 mpz_clear(dest); 456 512 if(res->s==0) 457 iz=(long)npDiv((number)iz,(number)in );513 iz=(long)npDiv((number)iz,(number)in,dst_r); 458 514 omFreeBin((void *)res, rnumber_bin); 459 515 return (number)iz; … … 507 563 if (n_GetChar(src) == n_GetChar(dst)) 508 564 { 509 return ndCopy ;565 return ndCopyMap; 510 566 } 511 567 else 512 568 { 513 npMapPrime=n_GetChar(src);514 569 return npMapP; 515 570 }
Note: See TracChangeset
for help on using the changeset viewer.