Changeset f8e5457 in git
- Timestamp:
- Jan 8, 2008, 3:23:35 PM (15 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'c18334b998a8adbf0013b8e1ce0824774019443e')
- Children:
- cc455372caef57b06d2a299f576b2072e6679ac4
- Parents:
- 0fb33365c938bc91c1860b13dbd981c5869f942d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/int_int.cc
r0fb3336 rf8e5457 1 1 /* emacs edit mode for this file is -*- C++ -*- */ 2 /* $Id: int_int.cc,v 1.2 0 2008-01-07 13:33:10Singular Exp $ */2 /* $Id: int_int.cc,v 1.21 2008-01-08 14:23:35 Singular Exp $ */ 3 3 4 4 #include <config.h> … … 173 173 mpz_init( &dummy ); 174 174 mpz_mul( &dummy, &thempi, &MPI( c ) ); 175 #if 0 175 176 if ( mpz_is_imm( &dummy ) ) 176 177 { … … 181 182 } 182 183 else 184 #endif 183 185 return new InternalInteger( dummy ); 184 186 } … … 186 188 { 187 189 mpz_mul( &thempi, &thempi, &MPI( c ) ); 190 #if 0 188 191 if ( mpz_is_imm( &thempi ) ) 189 192 { … … 194 197 } 195 198 else 199 #endif 196 200 return this; 197 201 } … … 242 246 else 243 247 mpz_add_ui( &thempi, &thempi, cc ); 244 if ( mpz_is_imm( &thempi ) ) { 248 if ( mpz_is_imm( &thempi ) ) 249 { 245 250 InternalCF * res = int2imm( mpz_get_si( &thempi ) ); 246 251 delete this; … … 256 261 ASSERT( ::is_imm( c ) == INTMARK, "incompatible base coefficients" ); 257 262 int cc = imm2int( c ); 258 if ( getRefCount() > 1 ) { 259 decRefCount(); 260 MP_INT dummy; 261 if ( negate ) { 263 if ( getRefCount() > 1 ) 264 { 265 decRefCount(); 266 MP_INT dummy; 267 if ( negate ) 268 { 262 269 mpz_init_set_si( &dummy, cc ); 263 270 mpz_sub( &dummy, &dummy, &thempi ); 264 271 } 265 else { 272 else 273 { 266 274 mpz_init( &dummy ); 267 275 if ( cc < 0 ) … … 270 278 mpz_sub_ui( &dummy, &thempi, cc ); 271 279 } 272 if ( mpz_is_imm( &dummy ) ) { 280 if ( mpz_is_imm( &dummy ) ) 281 { 273 282 InternalCF * res = int2imm( mpz_get_si( &dummy ) ); 274 283 mpz_clear( &dummy ); … … 278 287 return new InternalInteger( dummy ); 279 288 } 280 else { 281 if ( negate ) { 289 else 290 { 291 if ( negate ) 292 { 282 293 MP_INT dummy; 283 294 mpz_init_set_si( &dummy, cc ); … … 290 301 else 291 302 mpz_sub_ui( &thempi, &thempi, cc ); 292 if ( mpz_is_imm( &thempi ) ) { 303 if ( mpz_is_imm( &thempi ) ) 304 { 293 305 InternalCF * res = int2imm( mpz_get_si( &thempi ) ); 294 306 delete this; … … 304 316 ASSERT( ::is_imm( c ) == INTMARK, "incompatible base coefficients" ); 305 317 int cc = imm2int( c ); 306 if ( getRefCount() > 1 ) { 307 decRefCount(); 308 MP_INT dummy; 309 mpz_init( &dummy ); 310 if ( cc < 0 ) { 311 mpz_mul_ui( &dummy, &thempi, -cc ); 312 mpz_neg( &dummy, &dummy ); 313 } 314 else 315 mpz_mul_ui( &dummy, &thempi, cc ); 316 if ( mpz_is_imm( &dummy ) ) { 318 if ( getRefCount() > 1 ) 319 { 320 decRefCount(); 321 MP_INT dummy; 322 mpz_init( &dummy ); 323 if ( cc < 0 ) 324 { 325 mpz_mul_ui( &dummy, &thempi, -cc ); 326 mpz_neg( &dummy, &dummy ); 327 } 328 else 329 mpz_mul_ui( &dummy, &thempi, cc ); 330 if ( mpz_is_imm( &dummy ) ) 331 { 317 332 InternalCF * res = int2imm( mpz_get_si( &dummy ) ); 318 333 mpz_clear( &dummy ); … … 322 337 return new InternalInteger( dummy ); 323 338 } 324 else { 325 if ( cc < 0 ) { 339 else 340 { 341 if ( cc < 0 ) 342 { 326 343 mpz_mul_ui( &thempi, &thempi, -cc ); 327 344 mpz_neg( &thempi, &thempi ); … … 329 346 else 330 347 mpz_mul_ui( &thempi, &thempi, cc ); 331 if ( mpz_is_imm( &thempi ) ) { 348 if ( mpz_is_imm( &thempi ) ) 349 { 332 350 InternalCF * res = int2imm( mpz_get_si( &thempi ) ); 333 351 delete this; … … 357 375 358 376 // check for immediate result 359 if ( mpz_is_imm( &result ) ) { 377 if ( mpz_is_imm( &result ) ) 378 { 360 379 InternalCF * res = int2imm( mpz_get_si( &result ) ); 361 380 mpz_clear( &result );
Note: See TracChangeset
for help on using the changeset viewer.