(root)/
glibc-2.38/
sysdeps/
ieee754/
ldbl-128ibm/
s_fabsl.c
       1  /* s_fabsl.c -- long double version of s_fabs.c.
       2   */
       3  
       4  /*
       5   * ====================================================
       6   * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
       7   *
       8   * Developed at SunPro, a Sun Microsystems, Inc. business.
       9   * Permission to use, copy, modify, and distribute this
      10   * software is freely granted, provided that this notice
      11   * is preserved.
      12   * ====================================================
      13   */
      14  
      15  #if defined(LIBM_SCCS) && !defined(lint)
      16  static char rcsid[] = "$NetBSD: $";
      17  #endif
      18  
      19  
      20  /*
      21   * fabsl(x) returns the absolute value of x.
      22   */
      23  
      24  #include <math.h>
      25  #include <math_private.h>
      26  #include <math_ldbl_opt.h>
      27  #include <math-use-builtins.h>
      28  
      29  long double __fabsl(long double x)
      30  {
      31  #if USE_FABSL_BUILTIN
      32  	return __builtin_fabsl (x);
      33  #else
      34  	uint64_t hx, lx;
      35  	double xhi, xlo;
      36  
      37  	ldbl_unpack (x, &xhi, &xlo);
      38  	EXTRACT_WORDS64 (hx, xhi);
      39  	EXTRACT_WORDS64 (lx, xlo);
      40  	lx = lx ^ ( hx & 0x8000000000000000LL );
      41  	hx = hx & 0x7fffffffffffffffLL;
      42  	INSERT_WORDS64 (xhi, hx);
      43  	INSERT_WORDS64 (xlo, lx);
      44  	x = ldbl_pack (xhi, xlo);
      45  	return x;
      46  #endif
      47  }
      48  long_double_symbol (libm, __fabsl, fabsl);