]> sourceware.org Git - glibc.git/blame - sysdeps/ieee754/ldbl-128/s_totalordermagl.c
Make totalorder and totalordermag functions take pointer arguments.
[glibc.git] / sysdeps / ieee754 / ldbl-128 / s_totalordermagl.c
CommitLineData
cc6a8d74 1/* Total order operation on absolute values. ldbl-128 version.
04277e02 2 Copyright (C) 2016-2019 Free Software Foundation, Inc.
cc6a8d74
JM
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19#include <math.h>
20#include <math_private.h>
fd3b4e7c 21#include <libm-alias-ldouble.h>
6f322a89 22#include <nan-high-order-bit.h>
cc6a8d74 23#include <stdint.h>
42760d76
JM
24#include <shlib-compat.h>
25#include <first-versions.h>
cc6a8d74
JM
26
27int
42760d76 28__totalordermagl (const _Float128 *x, const _Float128 *y)
cc6a8d74
JM
29{
30 uint64_t hx, hy;
31 uint64_t lx, ly;
42760d76
JM
32 GET_LDOUBLE_WORDS64 (hx, lx, *x);
33 GET_LDOUBLE_WORDS64 (hy, ly, *y);
cc6a8d74
JM
34 hx &= 0x7fffffffffffffffULL;
35 hy &= 0x7fffffffffffffffULL;
6f322a89 36#if HIGH_ORDER_BIT_IS_SET_FOR_SNAN
cc6a8d74
JM
37 /* For the preferred quiet NaN convention, this operation is a
38 comparison of the representations of the absolute values of the
39 arguments. If both arguments are NaNs, invert the
40 quiet/signaling bit so comparing that way works. */
41 if ((hx > 0x7fff000000000000ULL || (hx == 0x7fff000000000000ULL
42 && lx != 0))
43 && (hy > 0x7fff000000000000ULL || (hy == 0x7fff000000000000ULL
44 && ly != 0)))
45 {
46 hx ^= 0x0000800000000000ULL;
47 hy ^= 0x0000800000000000ULL;
48 }
49#endif
50 return hx < hy || (hx == hy && lx <= ly);
51}
42760d76
JM
52#ifdef SHARED
53# define CONCATX(x, y) x ## y
54# define CONCAT(x, y) CONCATX (x, y)
55# define UNIQUE_ALIAS(name) CONCAT (name, __COUNTER__)
56# define do_symbol(orig_name, name, aliasname) \
57 strong_alias (orig_name, name) \
58 versioned_symbol (libm, name, aliasname, GLIBC_2_31)
59# undef weak_alias
60# define weak_alias(name, aliasname) \
61 do_symbol (name, UNIQUE_ALIAS (name), aliasname);
62#endif
fd3b4e7c 63libm_alias_ldouble (__totalordermag, totalordermag)
42760d76
JM
64#if SHLIB_COMPAT (libm, GLIBC_2_25, GLIBC_2_31)
65int
66attribute_compat_text_section
67__totalordermag_compatl (_Float128 x, _Float128 y)
68{
69 return __totalordermagl (&x, &y);
70}
71#undef do_symbol
72#define do_symbol(orig_name, name, aliasname) \
73 strong_alias (orig_name, name) \
74 compat_symbol (libm, name, aliasname, \
75 CONCAT (FIRST_VERSION_libm_, aliasname))
76libm_alias_ldouble (__totalordermag_compat, totalordermag)
77#endif
This page took 0.131758 seconds and 5 git commands to generate.