src/libm/s_fabs.c
author Ryan C. Gordon <icculus@icculus.org>
Thu, 21 Apr 2016 03:16:44 -0400
changeset 11729 d1ce8396c356
parent 11683 48bcba563d9c
permissions -rw-r--r--
Initial shot at a renderer target for Apple's Metal API.

This isn't complete, but is enough to run testsprite2. It's currently
Mac-only; with a little work to figure out how to properly glue in a Metal
layer to a UIView, this will likely work on iOS, too.

This is only wired up to the configure script right now, and disabled by
default. CMake and Xcode still need their bits filled in as appropriate.
slouken@2756
     1
/*
slouken@2756
     2
 * ====================================================
slouken@2756
     3
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
slouken@2756
     4
 *
slouken@2756
     5
 * Developed at SunPro, a Sun Microsystems, Inc. business.
slouken@2756
     6
 * Permission to use, copy, modify, and distribute this
slouken@2756
     7
 * software is freely granted, provided that this notice
slouken@2756
     8
 * is preserved.
slouken@2756
     9
 * ====================================================
slouken@2756
    10
 */
slouken@2756
    11
slouken@2756
    12
/*
slouken@2756
    13
 * fabs(x) returns the absolute value of x.
slouken@2756
    14
 */
slouken@2756
    15
slouken@11683
    16
/*#include <features.h>*/
slouken@11683
    17
/* Prevent math.h from defining a colliding inline */
slouken@11683
    18
#undef __USE_EXTERN_INLINES
slouken@6044
    19
#include "math_libm.h"
slouken@2756
    20
#include "math_private.h"
slouken@2756
    21
slouken@11683
    22
double fabs(double x)
slouken@2756
    23
{
slouken@11683
    24
	u_int32_t high;
slouken@11683
    25
	GET_HIGH_WORD(high,x);
slouken@11683
    26
	SET_HIGH_WORD(x,high&0x7fffffff);
slouken@11683
    27
        return x;
slouken@2756
    28
}
slouken@2756
    29
libm_hidden_def(fabs)