Changeset 54bb6b in git for libpolys/coeffs/rintegers.cc
- Timestamp:
- Jul 3, 2018, 5:23:27 PM (5 years ago)
- Branches:
- (u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
- Children:
- acb07ec581d8593b7eb367dd1cbd785808f4ae86
- Parents:
- 417a91a95b5bf03f8ca333971553909c72f2568f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/coeffs/rintegers.cc
r417a91a r54bb6b 135 135 static void nrzDelete(number *a, const coeffs) 136 136 { 137 if (*a == NULL) return; 138 mpz_clear((mpz_ptr) *a); 139 omFreeBin((ADDRESS) *a, gmp_nrz_bin); 140 *a = NULL; 137 if (*a != NULL) 138 { 139 mpz_clear((mpz_ptr) *a); 140 omFreeBin((ADDRESS) *a, gmp_nrz_bin); 141 *a = NULL; 142 } 141 143 } 142 144 … … 158 160 static int nrzSize(number a, const coeffs) 159 161 { 160 if (a == NULL) return 0; 161 return (((mpz_ptr)a)->_mp_alloc); 162 mpz_ptr p=(mpz_ptr)a; 163 int s=p->_mp_alloc; 164 if (s==1) s=(mpz_cmp_ui(p,0)!=0); 165 return s; 166 162 167 } 163 168 … … 203 208 static BOOLEAN nrzIsOne (number a, const coeffs) 204 209 { 205 return ( a!=NULL) && (0 == mpz_cmp_ui((mpz_ptr) a, 1));210 return (0 == mpz_cmp_ui((mpz_ptr) a, 1)); 206 211 } 207 212 208 213 static BOOLEAN nrzIsMOne (number a, const coeffs) 209 214 { 210 return ( a!=NULL) && (0 == mpz_cmp_si((mpz_ptr) a, -1));215 return (0 == mpz_cmp_si((mpz_ptr) a, -1)); 211 216 } 212 217 … … 303 308 { 304 309 WerrorS("Non invertible element."); 305 return (number) 0; //TODO310 return (number)NULL; 306 311 } 307 312 return nrzCopy(c,r); … … 685 690 static int nrzSize(number a, const coeffs) 686 691 { 687 if (a == NULL) return 0;688 692 if (a==INT_TO_SR(0)) return 0; 689 693 if (n_Z_IS_SMALL(a)) return 1; … … 717 721 #endif 718 722 { 719 if (n_Z_IS_SMALL(a) && n_Z_IS_SMALL(b)) { 723 if (n_Z_IS_SMALL(a) && n_Z_IS_SMALL(b)) 724 { 720 725 //from longrat.cc 721 726 if (SR_TO_INT(a)==0) … … 1315 1320 static BOOLEAN nrzIsZero (number a, const coeffs) 1316 1321 { 1317 return (a== NULL) || (a==INT_TO_SR(0));1322 return (a==INT_TO_SR(0)); 1318 1323 } 1319 1324 … … 1483 1488 { 1484 1489 WerrorS("Non invertible element."); 1485 return (number) 0; //TODO1490 return (number)NULL; 1486 1491 } 1487 1492 return c; // has to be 1 or -1....
Note: See TracChangeset
for help on using the changeset viewer.