/[gcl]/gcl/o/gmp_num_log.c
ViewVC logotype

Diff of /gcl/o/gmp_num_log.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by camm, Thu Dec 19 04:12:39 2002 UTC revision 1.5 by camm, Sat Feb 15 00:38:28 2003 UTC
# Line 8  Line 8 
8  object big_log_op();  object big_log_op();
9  object normalize_big(object);  object normalize_big(object);
10    
11  object  static object
12  log_op(int (*op) (/* ??? */), void (*mp_op) (/* ??? */))  log_op(int (*op) (/* ??? */), void (*mp_op) (/* ??? */))
13  {  {
14          object x;          object x;
# Line 45  BIG_OP: Line 45  BIG_OP:
45  }  }
46    
47    
48  void  static void
49  mp_and_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_and_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
50  {  {
51          mpz_and(u,i,j);          mpz_and(u,i,j);
52           /* (i & j); */           /* (i & j); */
53  }  }
54    
55  void  static void
56  mp_eqv_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_eqv_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
57  {  {
58          mpz_xor(u,i,j);          mpz_xor(u,i,j);
# Line 61  mp_eqv_op(__mpz_struct *u, __mpz_struct Line 61  mp_eqv_op(__mpz_struct *u, __mpz_struct
61    
62  }  }
63    
64  void  static void
65  mp_nand_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_nand_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
66  {  {
67          mpz_and(u,i,j);          mpz_and(u,i,j);
# Line 69  mp_nand_op(__mpz_struct *u, __mpz_struct Line 69  mp_nand_op(__mpz_struct *u, __mpz_struct
69          /* (~(i & j)); */          /* (~(i & j)); */
70  }  }
71    
72  void  static void
73  mp_nor_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_nor_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
74  {  {
75  /*      mpz_ior(u,u,j); */  /*      mpz_ior(u,u,j); */
# Line 79  mp_nor_op(__mpz_struct *u, __mpz_struct Line 79  mp_nor_op(__mpz_struct *u, __mpz_struct
79       /* (~(i | j)); */       /* (~(i | j)); */
80  }  }
81    
82  void  static void
83  mp_andc1_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_andc1_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
84  {  {
85       mpz_com(i,i);       mpz_com(i,i);
# Line 87  mp_andc1_op(__mpz_struct *u, __mpz_struc Line 87  mp_andc1_op(__mpz_struct *u, __mpz_struc
87          /* ((~i) & j); */          /* ((~i) & j); */
88  }  }
89    
90  void  static void
91  mp_andc2_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_andc2_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
92  {  {
93        mpz_com(j,j);        mpz_com(j,j);
# Line 95  mp_andc2_op(__mpz_struct *u, __mpz_struc Line 95  mp_andc2_op(__mpz_struct *u, __mpz_struc
95          /* (i & (~j));*/          /* (i & (~j));*/
96  }  }
97    
98  void  static void
99  mp_orc1_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_orc1_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
100  {  {
101     mpz_com(i,i);     mpz_com(i,i);
# Line 103  mp_orc1_op(__mpz_struct *u, __mpz_struct Line 103  mp_orc1_op(__mpz_struct *u, __mpz_struct
103  /*      ((~i) | j); */  /*      ((~i) | j); */
104  }  }
105    
106  void  static void
107  mp_orc2_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_orc2_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
108  {  {
109      mpz_com(j,j);      mpz_com(j,j);
# Line 111  mp_orc2_op(__mpz_struct *u, __mpz_struct Line 111  mp_orc2_op(__mpz_struct *u, __mpz_struct
111          /* (i | (~j)); */          /* (i | (~j)); */
112  }  }
113    
114  void  static void
115  mp_b_clr_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_b_clr_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
116  {  {
117      mpz_set_si(u,0);      mpz_set_si(u,0);
118  /*      (0); */  /*      (0); */
119  }  }
120    
121  void  static void
122  mp_b_set_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_b_set_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
123  {  {
124     mpz_set_si(u,-1);     mpz_set_si(u,-1);
125          /* (-1); */          /* (-1); */
126  }  }
127    
128  void  static void
129  mp_b_1_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_b_1_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
130  {  {
131      mpz_set(u,i);      mpz_set(u,i);
132     /*   (i); */     /*   (i); */
133  }  }
134    
135  void  static void
136  mp_b_2_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_b_2_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
137  {  {
138     mpz_set(u,j);     mpz_set(u,j);
139  /*      (j); */  /*      (j); */
140  }  }
141    
142  void  static void
143  mp_b_c1_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_b_c1_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
144  {  {
145    mpz_com(u,i);    mpz_com(u,i);
146          /* (~i); */          /* (~i); */
147  }  }
148    
149  void  static void
150  mp_b_c2_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_b_c2_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
151  {  {
152     mpz_com(u,j);     mpz_com(u,j);
# Line 156  mp_b_c2_op(__mpz_struct *u, __mpz_struct Line 156  mp_b_c2_op(__mpz_struct *u, __mpz_struct
156    
157    
158    
159  int  static int
160  big_bitp(object x, int p)  big_bitp(object x, int p)
161  {  {
162    return mpz_tstbit(MP(x),p);    return mpz_tstbit(MP(x),p);
# Line 166  big_bitp(object x, int p) Line 166  big_bitp(object x, int p)
166    
167        
168    
169  void  static void
170  mp_ior_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_ior_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
171  {  {
172          mpz_ior(u,i,j);          mpz_ior(u,i,j);
173      /* (i | j); */      /* (i | j); */
174  }  }
175    
176  void  static void
177  mp_xor_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)  mp_xor_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
178  {  {
179          mpz_xor(u,i,j);          mpz_xor(u,i,j);
180    /* (i ^ j); */    /* (i ^ j); */
181  }  }
182    
183  int  static int
184  mpz_bitcount(__mpz_struct *x)  mpz_bitcount(__mpz_struct *x)
185  {  {
186    if (mpz_sgn(x) >= 0) {    if (mpz_sgn(x) >= 0) {
# Line 193  mpz_bitcount(__mpz_struct *x) Line 193  mpz_bitcount(__mpz_struct *x)
193  }  }
194    
195    
196  int  static int
197  mpz_bitlength(__mpz_struct *x)  mpz_bitlength(__mpz_struct *x)
198  {  {
199    if (mpz_sgn(x) >= 0) {    if (mpz_sgn(x) >= 0) {

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26