My Project
debian-1:4.1.2-p1+ds-2
factory
cf_util.cc
Go to the documentation of this file.
1
/* emacs edit mode for this file is -*- C++ -*- */
2
3
/**
4
*
5
* @file cf_util.cc
6
*
7
* miscellaneous functions, not necessarily related
8
* to canonical forms.
9
*
10
* Used by: fac_cantzass.cc, gfops.cc
11
*
12
**/
13
14
15
#include "
factory/globaldefs.h
"
16
#include "config.h"
17
18
19
/** int ipower ( int b, int m )
20
*
21
* ipower() - calculate b^m in standard integer arithmetic.
22
*
23
* Note: Beware of overflows.
24
*
25
**/
26
int
ipower
(
int
b
,
int
m
)
27
{
28
int
prod
= 1;
29
30
while
(
m
!= 0 )
31
{
32
if
(
m
% 2 != 0 )
33
prod
*=
b
;
34
m
/= 2;
35
if
(
m
!= 0 )
36
b
*=
b
;
37
}
38
return
prod
;
39
}
40
41
int
ilog2
(
int
a)
42
{
43
int
n = -1;
44
while
( a > 0 )
45
{
46
n++;
47
a /=2;
48
}
49
return
n;
50
}
51
52
int
igcd
(
int
a,
int
b
)
53
{
54
if
( a < 0 ) a = -a;
55
if
(
b
< 0 )
b
= -
b
;
56
57
int
c;
58
59
while
(
b
!= 0 )
60
{
61
c = a %
b
;
62
a =
b
;
63
b
= c;
64
}
65
return
a;
66
}
67
68
#include<stdio.h>
69
#include<stdlib.h>
70
71
void
factoryError_intern
(
const
char
*
s
)
72
{
73
fputs(
s
,stderr);
74
abort();
75
}
76
VAR
void (*
factoryError
)(
const
char
*
s
) =
factoryError_intern
;
77
78
globaldefs.h
prod
fq_nmod_poly_t prod
Definition:
facHensel.cc:95
ilog2
int ilog2(int a)
Definition:
cf_util.cc:41
b
CanonicalForm b
Definition:
cfModGcd.cc:4044
VAR
#define VAR
Definition:
globaldefs.h:5
ipower
int ipower(int b, int m)
int ipower ( int b, int m )
Definition:
cf_util.cc:26
igcd
int igcd(int a, int b)
Definition:
cf_util.cc:52
m
int m
Definition:
cfEzgcd.cc:121
s
const CanonicalForm int s
Definition:
facAbsFact.cc:55
factoryError_intern
void factoryError_intern(const char *s)
Definition:
cf_util.cc:71
factoryError
VAR void(* factoryError)(const char *s)
Definition:
cf_util.cc:76
Generated on Thu Jan 9 2020 20:32:43 for My Project by
doxygen 1.8.16
for
Singular debian-1:4.1.2-p1+ds-2