My Project  debian-1:4.1.1-p2+ds-4build2
Functions | Variables
cf_util.h File Reference

Go to the source code of this file.

Functions

int ilog2 (int a)
 
int igcd (int a, int b)
 
int ipower (int b, int n)
 int ipower ( int b, int m ) More...
 
void factoryError_intern (const char *s)
 

Variables

void(* factoryError )(const char *s)
 

Function Documentation

◆ factoryError_intern()

void factoryError_intern ( const char *  s)

Definition at line 70 of file cf_util.cc.

71 {
72  fputs(s,stderr);
73  abort();
74 }

◆ igcd()

int igcd ( int  a,
int  b 
)

Definition at line 51 of file cf_util.cc.

52 {
53  if ( a < 0 ) a = -a;
54  if ( b < 0 ) b = -b;
55 
56  int c;
57 
58  while ( b != 0 )
59  {
60  c = a % b;
61  a = b;
62  b = c;
63  }
64  return a;
65 }

◆ ilog2()

int ilog2 ( int  a)

Definition at line 40 of file cf_util.cc.

41 {
42  int n = -1;
43  while ( a > 0 )
44  {
45  n++;
46  a /=2;
47  }
48  return n;
49 }

◆ ipower()

int ipower ( int  b,
int  m 
)

int ipower ( int b, int m )

ipower() - calculate b^m in standard integer arithmetic.

Note: Beware of overflows.

Definition at line 25 of file cf_util.cc.

26 {
27  int prod = 1;
28 
29  while ( m != 0 )
30  {
31  if ( m % 2 != 0 )
32  prod *= b;
33  m /= 2;
34  if ( m != 0 )
35  b *= b;
36  }
37  return prod;
38 }

Variable Documentation

◆ factoryError

void(* factoryError) (const char *s)

Definition at line 75 of file cf_util.cc.

prod
fq_nmod_poly_t prod
Definition: facHensel.cc:95
b
CanonicalForm b
Definition: cfModGcd.cc:4044
m
int m
Definition: cfEzgcd.cc:121
s
const CanonicalForm int s
Definition: facAbsFact.cc:55