Changeset f8e5457 in git


Ignore:
Timestamp:
Jan 8, 2008, 3:23:35 PM (15 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'c18334b998a8adbf0013b8e1ce0824774019443e')
Children:
cc455372caef57b06d2a299f576b2072e6679ac4
Parents:
0fb33365c938bc91c1860b13dbd981c5869f942d
Message:
*hannes: some optiomzations


git-svn-id: file:///usr/local/Singular/svn/trunk@10497 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/int_int.cc

    r0fb3336 rf8e5457  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: int_int.cc,v 1.20 2008-01-07 13:33:10 Singular Exp $ */
     2/* $Id: int_int.cc,v 1.21 2008-01-08 14:23:35 Singular Exp $ */
    33
    44#include <config.h>
     
    173173        mpz_init( &dummy );
    174174        mpz_mul( &dummy, &thempi, &MPI( c ) );
     175        #if 0
    175176        if ( mpz_is_imm( &dummy ) )
    176177        {
     
    181182        }
    182183        else
     184        #endif
    183185            return new InternalInteger( dummy );
    184186    }
     
    186188    {
    187189        mpz_mul( &thempi, &thempi, &MPI( c ) );
     190        #if 0
    188191        if ( mpz_is_imm( &thempi ) )
    189192        {
     
    194197        }
    195198        else
     199        #endif
    196200            return this;
    197201    }
     
    242246        else
    243247            mpz_add_ui( &thempi, &thempi, cc );
    244         if ( mpz_is_imm( &thempi ) ) {
     248        if ( mpz_is_imm( &thempi ) )
     249        {
    245250            InternalCF * res = int2imm( mpz_get_si( &thempi ) );
    246251            delete this;
     
    256261    ASSERT( ::is_imm( c ) == INTMARK, "incompatible base coefficients" );
    257262    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        {
    262269            mpz_init_set_si( &dummy, cc );
    263270            mpz_sub( &dummy, &dummy, &thempi );
    264271        }
    265         else {
     272        else
     273        {
    266274            mpz_init( &dummy );
    267275            if ( cc < 0 )
     
    270278                mpz_sub_ui( &dummy, &thempi, cc );
    271279        }
    272         if ( mpz_is_imm( &dummy ) ) {
     280        if ( mpz_is_imm( &dummy ) )
     281        {
    273282            InternalCF * res = int2imm( mpz_get_si( &dummy ) );
    274283            mpz_clear( &dummy );
     
    278287            return new InternalInteger( dummy );
    279288    }
    280     else {
    281         if ( negate ) {
     289    else
     290    {
     291        if ( negate )
     292        {
    282293            MP_INT dummy;
    283294            mpz_init_set_si( &dummy, cc );
     
    290301            else
    291302                mpz_sub_ui( &thempi, &thempi, cc );
    292         if ( mpz_is_imm( &thempi ) ) {
     303        if ( mpz_is_imm( &thempi ) )
     304        {
    293305            InternalCF * res = int2imm( mpz_get_si( &thempi ) );
    294306            delete this;
     
    304316    ASSERT( ::is_imm( c ) == INTMARK, "incompatible base coefficients" );
    305317    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        {
    317332            InternalCF * res = int2imm( mpz_get_si( &dummy ) );
    318333            mpz_clear( &dummy );
     
    322337            return new InternalInteger( dummy );
    323338    }
    324     else {
    325         if ( cc < 0 ) {
     339    else
     340    {
     341        if ( cc < 0 )
     342        {
    326343            mpz_mul_ui( &thempi, &thempi, -cc );
    327344            mpz_neg( &thempi, &thempi );
     
    329346        else
    330347            mpz_mul_ui( &thempi, &thempi, cc );
    331         if ( mpz_is_imm( &thempi ) ) {
     348        if ( mpz_is_imm( &thempi ) )
     349        {
    332350            InternalCF * res = int2imm( mpz_get_si( &thempi ) );
    333351            delete this;
     
    357375
    358376    // check for immediate result
    359     if ( mpz_is_imm( &result ) ) {
     377    if ( mpz_is_imm( &result ) )
     378    {
    360379        InternalCF * res = int2imm( mpz_get_si( &result ) );
    361380        mpz_clear( &result );
Note: See TracChangeset for help on using the changeset viewer.