Changeset 1e6de6 in git for factory/int_int.cc


Ignore:
Timestamp:
Jan 7, 2008, 2:33:11 PM (16 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
aa7480c120ef293aaf5a185ec38a2440c23fc879
Parents:
6840b2040b65b549b02b0e852339ab1a0a791484
Message:
*hannes: some optimizations(gcd)


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

Legend:

Unmodified
Added
Removed
  • factory/int_int.cc

    r6840b2 r1e6de6  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: int_int.cc,v 1.19 2007-12-04 15:24:53 Singular Exp $ */
     2/* $Id: int_int.cc,v 1.20 2008-01-07 13:33:10 Singular Exp $ */
    33
    44#include <config.h>
     
    8686InternalInteger::neg ()
    8787{
    88     if ( getRefCount() > 1 ) {
     88    if ( getRefCount() > 1 )
     89    {
    8990        decRefCount();
    9091        MP_INT dummy;
     
    9293        mpz_neg( &dummy, &dummy );
    9394        return new InternalInteger( dummy );
    94     } else {
     95    }
     96    else
     97    {
    9598        mpz_neg( &thempi, &thempi );
    9699        return this;
     
    102105InternalCF* InternalInteger::addsame( InternalCF * c )
    103106{
    104     if ( getRefCount() > 1 ) {
     107    if ( getRefCount() > 1 )
     108    {
    105109        decRefCount();
    106110        MP_INT dummy;
    107111        mpz_init( &dummy );
    108112        mpz_add( &dummy, &thempi, &MPI( c ) );
    109         if ( mpz_is_imm( &dummy ) ) {
     113        if ( mpz_is_imm( &dummy ) )
     114        {
    110115            InternalCF * res = int2imm( mpz_get_si( &dummy ) );
    111116            mpz_clear( &dummy );
     
    115120            return new InternalInteger( dummy );
    116121    }
    117     else {
     122    else
     123    {
    118124        mpz_add( &thempi, &thempi, &MPI( c ) );
    119         if ( mpz_is_imm( &thempi ) ) {
     125        if ( mpz_is_imm( &thempi ) )
     126        {
    120127            InternalCF * res = int2imm( mpz_get_si( &thempi ) );
    121128            delete this;
     
    129136InternalCF* InternalInteger::subsame( InternalCF * c )
    130137{
    131     if ( getRefCount() > 1 ) {
     138    if ( getRefCount() > 1 )
     139    {
    132140        decRefCount();
    133141        MP_INT dummy;
    134142        mpz_init( &dummy );
    135143        mpz_sub( &dummy, &thempi, &MPI( c ) );
    136         if ( mpz_is_imm( &dummy ) ) {
     144        if ( mpz_is_imm( &dummy ) )
     145        {
    137146            InternalCF * res = int2imm( mpz_get_si( &dummy ) );
    138147            mpz_clear( &dummy );
     
    142151            return new InternalInteger( dummy );
    143152    }
    144     else {
     153    else
     154    {
    145155        mpz_sub( &thempi, &thempi, &MPI( c ) );
    146         if ( mpz_is_imm( &thempi ) ) {
     156        if ( mpz_is_imm( &thempi ) )
     157        {
    147158            InternalCF * res = int2imm( mpz_get_si( &thempi ) );
    148159            delete this;
     
    156167InternalCF* InternalInteger::mulsame( InternalCF * c )
    157168{
    158     if ( getRefCount() > 1 ) {
     169    if ( getRefCount() > 1 )
     170    {
    159171        decRefCount();
    160172        MP_INT dummy;
    161173        mpz_init( &dummy );
    162174        mpz_mul( &dummy, &thempi, &MPI( c ) );
    163         if ( mpz_is_imm( &dummy ) ) {
     175        if ( mpz_is_imm( &dummy ) )
     176        {
     177        // can this happen ???
    164178            InternalCF * res = int2imm( mpz_get_si( &dummy ) );
    165179            mpz_clear( &dummy );
     
    169183            return new InternalInteger( dummy );
    170184    }
    171     else {
     185    else
     186    {
    172187        mpz_mul( &thempi, &thempi, &MPI( c ) );
    173         if ( mpz_is_imm( &thempi ) ) {
     188        if ( mpz_is_imm( &thempi ) )
     189        {
     190        // can this happen ???
    174191            InternalCF * res = int2imm( mpz_get_si( &thempi ) );
    175192            delete this;
     
    202219    ASSERT( ::is_imm( c ) == INTMARK, "incompatible base coefficients" );
    203220    int cc = imm2int( c );
    204     if ( getRefCount() > 1 ) {
     221    if ( getRefCount() > 1 )
     222    {
    205223        decRefCount();
    206224        MP_INT dummy;
     
    210228        else
    211229            mpz_add_ui( &dummy, &thempi, cc );
    212         if ( mpz_is_imm( &dummy ) ) {
     230        if ( mpz_is_imm( &dummy ) )
     231        {
    213232            InternalCF * res = int2imm( mpz_get_si( &dummy ) );
    214233            mpz_clear( &dummy );
Note: See TracChangeset for help on using the changeset viewer.