(root)/
glibc-2.38/
sysdeps/
alpha/
ots_cmpe.c
       1  /* Software floating-point emulation: comparison.
       2     Copyright (C) 1997-2023 Free Software Foundation, Inc.
       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     <https://www.gnu.org/licenses/>.  */
      18  
      19  #include "local-soft-fp.h"
      20  
      21  static long
      22  internal_compare (long al, long ah, long bl, long bh)
      23  {
      24    FP_DECL_EX;
      25    FP_DECL_Q(A); FP_DECL_Q(B);
      26    long r;
      27  
      28    AXP_UNPACK_RAW_Q(A, a);
      29    AXP_UNPACK_RAW_Q(B, b);
      30    FP_CMP_Q (r, A, B, 2, 2);
      31  
      32    FP_HANDLE_EXCEPTIONS;
      33  
      34    return r;
      35  }
      36  
      37  long
      38  _OtsLssX (long al, long ah, long bl, long bh)
      39  {
      40    long r = internal_compare (al, ah, bl, bh);
      41    if (r == 2)
      42      return -1;
      43    else
      44      return r < 0;
      45  }
      46  
      47  long
      48  _OtsLeqX (long al, long ah, long bl, long bh)
      49  {
      50    long r = internal_compare (al, ah, bl, bh);
      51    if (r == 2)
      52      return -1;
      53    else
      54      return r <= 0;
      55  }
      56  
      57  long
      58  _OtsGtrX (long al, long ah, long bl, long bh)
      59  {
      60    long r = internal_compare (al, ah, bl, bh);
      61    if (r == 2)
      62      return -1;
      63    else
      64      return r > 0;
      65  }
      66  
      67  long
      68  _OtsGeqX (long al, long ah, long bl, long bh)
      69  {
      70    long r = internal_compare (al, ah, bl, bh);
      71    if (r == 2)
      72      return -1;
      73    else
      74      return r >= 0;
      75  }