Changeset 8c2051 in git


Ignore:
Timestamp:
Oct 4, 2010, 7:28:36 PM (14 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38077648e7239f98078663eb941c3c979511150a')
Children:
3112fe486f6ef925872fb0f70c02d25ff6328060
Parents:
4326e5b680361011d38f1ddc9d4295b9176cb475
Message:
primefactors: opt.

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

Legend:

Unmodified
Added
Removed
  • Singular/misc_ip.cc

    r4326e5 r8c2051  
    219219
    220220    unsigned long p_ui=5; add = 2;
     221    BOOLEAN b_is_0=(mpz_cmp_ui(b, 0) == 0);
    221222    mpz_sqrt(sr, nn);
    222223    // there are 3 possible limits, we take the minimum:
     
    224225    // - sr = sqrt(nn)
    225226    // - 1<<31
    226     unsigned long  limit=1<<31;
    227     if ((mpz_cmp_ui(b, 0) == 0) || (mpz_cmp(pb, sr) > 0))
     227    unsigned long  limit=~(0L);
     228    if (b_is_0 || (mpz_cmp(pb, sr) > 0))
    228229    {
    229230      mpz_set(pb, sr);
    230231    }
    231     if (mpz_cmp_ui(b, limit)<0)
     232    if (mpz_cmp_ui(pb, limit)<0)
    232233    {
    233234     limit=mpz_get_ui(pb);
     
    278279    mpz_set_ui(p, p_ui);
    279280    mpz_sqrt(sr, nn);
    280     if ((mpz_cmp_ui(b, 0) == 0) || (mpz_cmp(pb, sr) > 0)) mpz_set(pb, sr);
     281    if (b_is_0 || (mpz_cmp(pb, sr) > 0)) mpz_set(pb, sr);
    281282    while (mpz_cmp(pb, p) >= 0)
    282283    {
     
    287288        multiplicities[index++] = tt;
    288289        mpz_sqrt(sr, nn);
    289         if ((mpz_cmp_ui(b, 0) == 0) || (mpz_cmp(pb, sr) > 0)) mpz_set(pb, sr);
     290        if (b_is_0 || (mpz_cmp(pb, sr) > 0)) mpz_set(pb, sr);
    290291        if (mpz_cmp_ui(nn,1)==0) break;
    291292      }
     
    294295    }
    295296    if ((mpz_cmp_ui(nn, 1) > 0) &&
    296         ((mpz_cmp_ui(b, 0) == 0) || (mpz_cmp(nn, pb) <= 0)))
     297        (b_is_0 || (mpz_cmp(nn, pb) <= 0)))
    297298    {
    298299      setListEntry(primes, index, nn);
Note: See TracChangeset for help on using the changeset viewer.