[BACK]Return to set_str.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp / mpz

Diff for /OpenXM_contrib/gmp/mpz/Attic/set_str.c between version 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2000/09/09 14:12:57 version 1.1.1.3, 2003/08/25 16:06:34
Line 4 
Line 4 
    the base in the C standard way, i.e.  0xhh...h means base 16,     the base in the C standard way, i.e.  0xhh...h means base 16,
    0oo...o means base 8, otherwise assume base 10.     0oo...o means base 8, otherwise assume base 10.
   
 Copyright (C) 1991, 1993, 1994, 1996, 1997, 1998, 2000 Free Software  Copyright 1991, 1993, 1994, 1996, 1997, 1998, 2000, 2001, 2002 Free Software
 Foundation, Inc.  Foundation, Inc.
   
 This file is part of the GNU MP Library.  This file is part of the GNU MP Library.
Line 31  MA 02111-1307, USA. */
Line 31  MA 02111-1307, USA. */
 #include "longlong.h"  #include "longlong.h"
   
 static int  static int
 #if __STDC__  
 digit_value_in_base (int c, int base)  digit_value_in_base (int c, int base)
 #else  
 digit_value_in_base (c, base)  
      int c;  
      int base;  
 #endif  
 {  {
   int digit;    int digit;
   
Line 56  digit_value_in_base (c, base)
Line 50  digit_value_in_base (c, base)
 }  }
   
 int  int
 #if __STDC__  
 mpz_set_str (mpz_ptr x, const char *str, int base)  mpz_set_str (mpz_ptr x, const char *str, int base)
 #else  
 mpz_set_str (x, str, base)  
      mpz_ptr x;  
      const char *str;  
      int base;  
 #endif  
 {  {
   size_t str_size;    size_t str_size;
   char *s, *begs;    char *s, *begs;
Line 110  mpz_set_str (x, str, base)
Line 97  mpz_set_str (x, str, base)
         }          }
     }      }
   
   /* Skip leading zeros.  */    /* Skip leading zeros and white space.  */
   while (c == '0')    while (c == '0' || isspace (c))
     c = *str++;      c = *str++;
   /* Make sure the string does not become empty, mpn_set_str would fail.  */    /* Make sure the string does not become empty, mpn_set_str would fail.  */
   if (c == 0)    if (c == 0)
Line 144  mpz_set_str (x, str, base)
Line 131  mpz_set_str (x, str, base)
   str_size = s - begs;    str_size = s - begs;
   
   xsize = (((mp_size_t) (str_size / __mp_bases[base].chars_per_bit_exactly))    xsize = (((mp_size_t) (str_size / __mp_bases[base].chars_per_bit_exactly))
            / BITS_PER_MP_LIMB + 2);             / GMP_NUMB_BITS + 2);
   if (x->_mp_alloc < xsize)    if (x->_mp_alloc < xsize)
     _mpz_realloc (x, xsize);      _mpz_realloc (x, xsize);
   

Legend:
Removed from v.1.1.1.2  
changed lines
  Added in v.1.1.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>