Changeset a8af6a8 in git


Ignore:
Timestamp:
Jul 30, 2012, 11:40:04 AM (12 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
86aa4d5c1040128ae11af385a7d11c3d770d370e
Parents:
ed667705fe7e65276090037dbcb57ee42dc3023f
git-author:
Martin Lee <martinlee84@web.de>2012-07-30 11:40:04+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-07-30 17:24:23+02:00
Message:
chg: new command igcd to compute integer gcd
Location:
factory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_util.cc

    red66770 ra8af6a8  
    4848}
    4949
     50int igcd( int a, int b )
     51{
     52    if ( a < 0 ) a = -a;
     53    if ( b < 0 ) b = -b;
     54
     55    int c;
     56
     57    while ( b != 0 )
     58    {
     59        c = a % b;
     60        a = b;
     61        b = c;
     62    }
     63    return a;
     64}
     65
    5066#include<stdio.h>
    5167#include<stdlib.h>
  • factory/cf_util.h

    red66770 ra8af6a8  
    1515int ipower ( int b, int n );
    1616int ilog2 (int a);
     17int igcd (int a, int b);
    1718
    1819/*BEGINPUBLIC*/
Note: See TracChangeset for help on using the changeset viewer.