iwmfw - Add version 22 firmwares for AC3168 and AC8265 chipsets.
[dragonfly.git] / contrib / gmp / mpz / iset_str.c
blob302126fdcf7e5736c9aa66ed744a951d9becf642
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.
8 Copyright 1991, 1993, 1994, 1995, 2000, 2001, 2002 Free Software Foundation,
9 Inc.
11 This file is part of the GNU MP Library.
13 The GNU MP Library is free software; you can redistribute it and/or modify
14 it under the terms of the GNU Lesser General Public License as published by
15 the Free Software Foundation; either version 3 of the License, or (at your
16 option) any later version.
18 The GNU MP Library is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
21 License for more details.
23 You should have received a copy of the GNU Lesser General Public License
24 along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
26 #include "gmp.h"
27 #include "gmp-impl.h"
29 int
30 mpz_init_set_str (mpz_ptr x, const char *str, int base)
32 x->_mp_alloc = 1;
33 x->_mp_d = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
35 /* if str has no digits mpz_set_str leaves x->_mp_size unset */
36 x->_mp_size = 0;
38 #ifdef __CHECKER__
39 /* let the low limb look initialized, for the benefit of mpz_get_ui etc */
40 x->_mp_d[0] = 0;
41 #endif
43 return mpz_set_str (x, str, base);