int *expt, int *is_neg,
long double value);
+#if __HAVE_DISTINCT_FLOAT128
+extern mp_size_t __mpn_extract_float128 (mp_ptr res_ptr, mp_size_t size,
+ int *expt, int *is_neg,
+ _Float128 value);
+#endif
+
extern float __mpn_construct_float (mp_srcptr frac_ptr, int expt, int sign);
extern double __mpn_construct_double (mp_srcptr frac_ptr, int expt,
#define powerof2(x) ((((x) - 1) & (x)) == 0)
/* Macros for min/max. */
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#define MAX(a,b) (((a)>(b))?(a):(b))
+#ifndef MIN
+# define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+#ifndef MAX
+# define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
#endif /* sys/param.h */
--- /dev/null
+ifeq ($(subdir),stdlib)
+routines += float1282mpn
+endif
--- /dev/null
+/* Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#define __FLOAT128_OVERRIDE
+
+#include "../ldbl-128/ldbl2mpn.c"
#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
-#include <ieee754.h>
-#include <float.h>
-#include <math.h>
-#include <stdlib.h>
+
+#ifdef __FLOAT128_OVERRIDE
+# include <float128_private.h>
+#else
+# include <ieee754.h>
+# include <float.h>
+# include <math.h>
+#endif
/* Convert a `long double' in IEEE854 quad-precision format to a
multi-precision integer representing the significand scaled up by its
(MPN frexpl). */
mp_size_t
+#ifdef __FLOAT128_OVERRIDE
+__mpn_extract_float128 (mp_ptr res_ptr, mp_size_t size,
+ int *expt, int *is_neg,
+ _Float128 value)
+#else
__mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
int *expt, int *is_neg,
long double value)
+#endif
{
union ieee854_long_double u;
u.d = value;