source: git/factory/cf_util.cc @ 281760

fieker-DuValspielwiese
Last change on this file since 281760 was b07fd0, checked in by Jens Schmidt <schmidt@…>, 27 years ago
* cf_util.cc: doc fix git-svn-id: file:///usr/local/Singular/svn/trunk@565 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 637 bytes
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id: cf_util.cc,v 1.4 1997-07-22 12:10:51 schmidt Exp $ */
3
4//{{{ docu
5//
6// cf_util.cc - miscellaneous functions, not necessarily related
7//   to canonical forms.
8//
9// Used by: fac_cantzass.cc, gfops.cc
10//
11//}}}
12
13#include <config.h>
14
15#include "cf_util.h"
16
17//{{{ int ipower ( int b, int m )
18//{{{ docu
19//
20// ipower() - calculate b^m in standard integer arithmetic.
21//
22// Note: Beware of overflows.
23//
24//}}}
25int
26ipower ( int b, int m )
27{
28    int prod = 1;
29
30    while ( m != 0 ) {
31        if ( m % 2 != 0 )
32            prod *= b;
33        m /= 2;
34        if ( m != 0 )
35            b *= b;
36    }
37    return prod;
38}
39//}}}
Note: See TracBrowser for help on using the repository browser.