1 1.1 mrg /* mpn_sizeinbase -- approximation to chars required for an mpn. 2 1.1 mrg 3 1.1 mrg THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST 4 1.1 mrg CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN 5 1.1 mrg FUTURE GNU MP RELEASES. 6 1.1 mrg 7 1.1.1.3 mrg Copyright 1991, 1993-1995, 2001, 2002, 2011, 2012 Free Software Foundation, 8 1.1.1.3 mrg Inc. 9 1.1 mrg 10 1.1 mrg This file is part of the GNU MP Library. 11 1.1 mrg 12 1.1 mrg The GNU MP Library is free software; you can redistribute it and/or modify 13 1.1.1.3 mrg it under the terms of either: 14 1.1.1.3 mrg 15 1.1.1.3 mrg * the GNU Lesser General Public License as published by the Free 16 1.1.1.3 mrg Software Foundation; either version 3 of the License, or (at your 17 1.1.1.3 mrg option) any later version. 18 1.1.1.3 mrg 19 1.1.1.3 mrg or 20 1.1.1.3 mrg 21 1.1.1.3 mrg * the GNU General Public License as published by the Free Software 22 1.1.1.3 mrg Foundation; either version 2 of the License, or (at your option) any 23 1.1.1.3 mrg later version. 24 1.1.1.3 mrg 25 1.1.1.3 mrg or both in parallel, as here. 26 1.1 mrg 27 1.1 mrg The GNU MP Library is distributed in the hope that it will be useful, but 28 1.1 mrg WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 29 1.1.1.3 mrg or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 30 1.1.1.3 mrg for more details. 31 1.1 mrg 32 1.1.1.3 mrg You should have received copies of the GNU General Public License and the 33 1.1.1.3 mrg GNU Lesser General Public License along with the GNU MP Library. If not, 34 1.1.1.3 mrg see https://www.gnu.org/licenses/. */ 35 1.1 mrg 36 1.1 mrg #include "gmp-impl.h" 37 1.1 mrg #include "longlong.h" 38 1.1 mrg 39 1.1 mrg 40 1.1 mrg /* Same as mpz_sizeinbase, meaning exact for power-of-2 bases, and either 41 1.1 mrg exact or 1 too big for other bases. */ 42 1.1 mrg 43 1.1 mrg size_t 44 1.1 mrg mpn_sizeinbase (mp_srcptr xp, mp_size_t xsize, int base) 45 1.1 mrg { 46 1.1.1.2 mrg size_t result; 47 1.1.1.2 mrg MPN_SIZEINBASE (result, xp, xsize, base); 48 1.1.1.2 mrg return result; 49 1.1 mrg } 50