~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to gmp3/mpz/iset_str.c

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* mpz_init_set_str(string, base) -- Convert the \0-terminated string
 
2
   STRING in base BASE to a multiple precision integer.  Return a MP_INT
 
3
   structure representing the integer.  Allow white space in the
 
4
   string.  If BASE == 0 determine the base in the C standard way,
 
5
   i.e.  0xhh...h means base 16, 0oo...o means base 8, otherwise
 
6
   assume base 10.
 
7
 
 
8
Copyright 1991, 1993, 1994, 1995, 2000, 2001 Free Software Foundation, Inc.
 
9
 
 
10
This file is part of the GNU MP Library.
 
11
 
 
12
The GNU MP Library is free software; you can redistribute it and/or modify
 
13
it under the terms of the GNU Lesser General Public License as published by
 
14
the Free Software Foundation; either version 2.1 of the License, or (at your
 
15
option) any later version.
 
16
 
 
17
The GNU MP Library is distributed in the hope that it will be useful, but
 
18
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
19
or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 
20
License for more details.
 
21
 
 
22
You should have received a copy of the GNU Lesser General Public License
 
23
along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
 
24
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 
25
MA 02111-1307, USA. */
 
26
 
 
27
#include "gmp.h"
 
28
#include "gmp-impl.h"
 
29
 
 
30
int
 
31
mpz_init_set_str (mpz_ptr x, const char *str, int base)
 
32
{
 
33
  x->_mp_alloc = 1;
 
34
  x->_mp_d = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
 
35
 
 
36
  /* if str has no digits mpz_set_str leaves x->_mp_size unset */
 
37
  x->_mp_size = 0;
 
38
 
 
39
  return mpz_set_str (x, str, base);
 
40
}