xref: /netbsd-src/external/lgpl3/gmp/dist/mpq/get_den.c (revision 72c7faa4dbb41dbb0238d6b4a109da0d4b236dd4)
151c586b8Smrg /* mpq_get_den(den,rat_src) -- Set DEN to the denominator of RAT_SRC.
251c586b8Smrg 
3dab47db4Smrg Copyright 1991, 1994, 1995, 2001, 2012 Free Software Foundation, Inc.
451c586b8Smrg 
551c586b8Smrg This file is part of the GNU MP Library.
651c586b8Smrg 
751c586b8Smrg The GNU MP Library is free software; you can redistribute it and/or modify
8*ce543368Smrg it under the terms of either:
9*ce543368Smrg 
10*ce543368Smrg   * the GNU Lesser General Public License as published by the Free
11*ce543368Smrg     Software Foundation; either version 3 of the License, or (at your
1251c586b8Smrg     option) any later version.
1351c586b8Smrg 
14*ce543368Smrg or
15*ce543368Smrg 
16*ce543368Smrg   * the GNU General Public License as published by the Free Software
17*ce543368Smrg     Foundation; either version 2 of the License, or (at your option) any
18*ce543368Smrg     later version.
19*ce543368Smrg 
20*ce543368Smrg or both in parallel, as here.
21*ce543368Smrg 
2251c586b8Smrg The GNU MP Library is distributed in the hope that it will be useful, but
2351c586b8Smrg WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24*ce543368Smrg or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25*ce543368Smrg for more details.
2651c586b8Smrg 
27*ce543368Smrg You should have received copies of the GNU General Public License and the
28*ce543368Smrg GNU Lesser General Public License along with the GNU MP Library.  If not,
29*ce543368Smrg see https://www.gnu.org/licenses/.  */
3051c586b8Smrg 
3151c586b8Smrg #include "gmp-impl.h"
3251c586b8Smrg 
3351c586b8Smrg void
mpq_get_den(mpz_ptr den,mpq_srcptr src)34dab47db4Smrg mpq_get_den (mpz_ptr den, mpq_srcptr src)
3551c586b8Smrg {
36dab47db4Smrg   mp_size_t size = SIZ(DEN(src));
37dab47db4Smrg   mp_ptr dp;
3851c586b8Smrg 
39dab47db4Smrg   dp = MPZ_NEWALLOC (den, size);
40dab47db4Smrg   SIZ(den) = size;
41dab47db4Smrg   MPN_COPY (dp, PTR(DEN(src)), size);
4251c586b8Smrg }
43