src/libm/s_copysign.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.
     1 /*
     2  * ====================================================
     3  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
     4  *
     5  * Developed at SunPro, a Sun Microsystems, Inc. business.
     6  * Permission to use, copy, modify, and distribute this
     7  * software is freely granted, provided that this notice
     8  * is preserved.
     9  * ====================================================
    10  */
    11 
    12 /*
    13  * copysign(double x, double y)
    14  * copysign(x,y) returns a value with the magnitude of x and
    15  * with the sign bit of y.
    16  */
    17 
    18 #include "math_libm.h"
    19 #include "math_private.h"
    20 
    21 double copysign(double x, double y)
    22 {
    23 	u_int32_t hx,hy;
    24 	GET_HIGH_WORD(hx,x);
    25 	GET_HIGH_WORD(hy,y);
    26 	SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
    27         return x;
    28 }
    29 libm_hidden_def(copysign)