Changeset d4932a in git for factory/cf_util.cc


Ignore:
Timestamp:
Jun 25, 2010, 4:25:41 PM (14 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd25190065115c859833252500a64cfb7b11e3a50')
Children:
cedebce21b0dc12678683874874cce5b35d8c23d
Parents:
9919421a652e331106b0f71cb3996f006942bc13
Message:
fix log(int) -> ilog2

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

Legend:

Unmodified
Added
Removed
  • factory/cf_util.cc

    r9919421 rd4932a  
    2121//
    2222//}}}
    23 int
    24 ipower ( int b, int m )
     23int ipower ( int b, int m )
    2524{
    2625    int prod = 1;
     
    2827    while ( m != 0 )
    2928    {
    30         if ( m % 2 != 0 )
    31             prod *= b;
    32         m /= 2;
    33         if ( m != 0 )
    34             b *= b;
     29        if ( m % 2 != 0 )
     30            prod *= b;
     31        m /= 2;
     32        if ( m != 0 )
     33            b *= b;
    3534    }
    3635    return prod;
    3736}
    3837//}}}
     38
     39int ilog2 (int a)
     40{
     41  int n = -1;
     42  while ( a != 0 )
     43  {
     44    n++;
     45    a /=2;
     46  }
     47  return n;
     48}
Note: See TracChangeset for help on using the changeset viewer.