Changeset 174bcf in git for factory


Ignore:
Timestamp:
Dec 2, 2016, 4:27:32 PM (7 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
5d623cb00f9b1b1db6a147618239b85006bd1316f5951957f709ab2bd04faad6ed4b08b554fb6f6c
Parents:
d28d26219b3d78927ebd32930fa42dbe5324c734
Message:
opt: conversion singular -> factory for small int
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/singext.cc

    rd28d26 r174bcf  
    6464}
    6565
    66 CanonicalForm
    67 make_cf ( const mpz_ptr n )
     66#ifndef ABS
     67#define ABS(x) ((x)<0?(-(x)):(x))
     68#endif
     69
     70CanonicalForm make_cf ( const mpz_ptr n )
    6871{
     72    if (ABS(n->_mp_size)<=1)
     73    {
     74      long value=mpz_get_si(n);
     75      if(value >= MINIMMEDIATE && value <= MAXIMMEDIATE )
     76        return CanonicalForm(int2imm( value ));
     77    }
    6978    return CanonicalForm( CFFactory::basic( n ) );
    7079}
    7180
    72 CanonicalForm
    73 make_cf ( const mpz_ptr n, const mpz_ptr d, bool normalize )
     81CanonicalForm make_cf ( const mpz_ptr n, const mpz_ptr d, bool normalize )
    7482{
    7583    return CanonicalForm( CFFactory::rational( n, d, normalize ) );
Note: See TracChangeset for help on using the changeset viewer.