/[m4]/m4/modules/mpeval.c
ViewVC logotype

Diff of /m4/modules/mpeval.c

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

revision 1.5 by gary, Sun Aug 19 10:53:56 2001 UTC revision 1.6 by gary, Mon Aug 20 19:42:38 2001 UTC
# Line 108  m4_macro m4_macro_table[] = Line 108  m4_macro m4_macro_table[] =
108  /* number should be at least 32 bits.  */  /* number should be at least 32 bits.  */
109  typedef mpq_t number;  typedef mpq_t number;
110    
111  extern boolean m4_mp_evaluate M4_PARAMS((struct obstack *obs, const char *,  extern boolean m4_mp_evaluate   (struct obstack *obs, const char *,
112                                           const int radix, int min));                                   const int radix, int min);
113  static void numb_initialise M4_PARAMS((void));  static void numb_initialise     (void);
114  static void numb_obstack M4_PARAMS((struct obstack *obs, const number value,  static void numb_obstack        (struct obstack *obs, const number value,
115                                      const int radix, int min));                                   const int radix, int min);
116  static void mpq2mpz M4_PARAMS((mpz_t z, const number q, const char *noisily));  static void mpq2mpz             (mpz_t z, const number q,
117  static void mpz2mpq M4_PARAMS((number q, const mpz_t z));                                   const char *noisily);
118  static void numb_divide M4_PARAMS((number *x, const number *y));  static void mpz2mpq             (number q, const mpz_t z);
119  static void numb_modulo M4_PARAMS((number *x, const number *y));  static void numb_divide         (number *x, const number *y);
120  static void numb_and M4_PARAMS((number *x, const number *y));  static void numb_modulo         (number *x, const number *y);
121  static void numb_ior M4_PARAMS((number *x, const number *y));  static void numb_and            (number *x, const number *y);
122  static void numb_eor M4_PARAMS((number *x, const number *y));  static void numb_ior            (number *x, const number *y);
123  static void numb_not M4_PARAMS((number *x));  static void numb_eor            (number *x, const number *y);
124  static void numb_lshift M4_PARAMS((number *x, const number *y));  static void numb_not            (number *x);
125  static void numb_rshift M4_PARAMS((number *x, const number *y));  static void numb_lshift         (number *x, const number *y);
126    static void numb_rshift         (number *x, const number *y);
127    
128    
129    
# Line 141  static number numb_ONE; Line 142  static number numb_ONE;
142  static int numb_initialised = 0;  static int numb_initialised = 0;
143    
144  static void  static void
145  numb_initialise ()  numb_initialise (void)
146  {  {
147    if (numb_initialised)    if (numb_initialised)
148      return;      return;
# Line 156  numb_initialise () Line 157  numb_initialise ()
157  }  }
158    
159  static void  static void
160  numb_obstack(obs, value, radix, min)  numb_obstack (struct obstack *obs, const number value, const int radix,
161       struct obstack *obs;                int min)
      const number value;  
      const int radix;  
      int min;  
162  {  {
163    const char *s;    const char *s;
164    
# Line 195  numb_obstack(obs, value, radix, min) Line 193  numb_obstack(obs, value, radix, min)
193  #define QUIET (char *)0  #define QUIET (char *)0
194    
195  static void  static void
196  mpq2mpz (z, q, noisily)  mpq2mpz (mpz_t z, const number q, const char *noisily)
      mpz_t z;  
      const number q;  
      const char *noisily;  
197  {  {
198    if (noisily && mpz_cmp_si (mpq_denref (q), (long) 1) != 0)    if (noisily && mpz_cmp_si (mpq_denref (q), (long) 1) != 0)
199      {      {
# Line 210  mpq2mpz (z, q, noisily) Line 205  mpq2mpz (z, q, noisily)
205  }  }
206    
207  static void  static void
208  mpz2mpq (q, z)  mpz2mpq (number q, const mpz_t z)
      number q;  
      const mpz_t z;  
209  {  {
210    mpq_set_si  (q, (long) 0, (unsigned long) 1);    mpq_set_si  (q, (long) 0, (unsigned long) 1);
211    mpq_set_num (q, z);    mpq_set_num (q, z);
212  }  }
213    
214  static void  static void
215  numb_divide (x, y)  numb_divide (number *x, const number *y)
      number *x;  
      const number *y;  
216  {  {
217     mpq_t qres;     mpq_t qres;
218     mpz_t zres;     mpz_t zres;
# Line 238  numb_divide (x, y) Line 229  numb_divide (x, y)
229  }  }
230    
231  static void  static void
232  numb_modulo (x, y)  numb_modulo (number *x, const number *y)
      number *x;  
      const number *y;  
233  {  {
234     mpz_t xx, yy, res;     mpz_t xx, yy, res;
235    
# Line 264  numb_modulo (x, y) Line 253  numb_modulo (x, y)
253  }  }
254    
255  static void  static void
256  numb_and(x, y)  numb_and(number *x, const number *y)
      number *x;  
      const number *y;  
257  {  {
258     mpz_t xx, yy, res;     mpz_t xx, yy, res;
259    
# Line 290  numb_and(x, y) Line 277  numb_and(x, y)
277  }  }
278    
279  static void  static void
280  numb_ior (x, y)  numb_ior (number *x, const number *y)
      number *x;  
      const number *y;  
281  {  {
282     mpz_t xx, yy, res;     mpz_t xx, yy, res;
283    
# Line 316  numb_ior (x, y) Line 301  numb_ior (x, y)
301  }  }
302    
303  static void  static void
304  numb_eor (x, y)  numb_eor (number *x, const number *y)
      number *x;  
      const number *y;  
305  {  {
306     mpz_t xx, yy, res;     mpz_t xx, yy, res;
307    
# Line 365  numb_eor (x, y) Line 348  numb_eor (x, y)
348  }  }
349    
350  static void  static void
351  numb_not (x)  numb_not (number *x)
      number *x;  
352  {  {
353     mpz_t xx, res;     mpz_t xx, res;
354    
# Line 385  numb_not (x) Line 367  numb_not (x)
367  }  }
368    
369  static void  static void
370  numb_lshift (x, y)  numb_lshift (number *x, const number *y)
      number *x;  
      const number *y;  
371  {  {
372     mpz_t xx, yy, res;     mpz_t xx, yy, res;
373    
# Line 418  numb_lshift (x, y) Line 398  numb_lshift (x, y)
398  }  }
399    
400  static void  static void
401  numb_rshift (x, y)  numb_rshift (number *x, const number *y)
      number *x;  
      const number *y;  
402  {  {
403     mpz_t xx, yy, res;     mpz_t xx, yy, res;
404    

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

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