diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-11-24 04:17:07 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-11-24 04:17:07 +0000 |
commit | 88e814e997c9bc4fd633583d4d6d4779c5b18cfb (patch) | |
tree | f17d860955fd44d9c8e7c13c04cf608fec91d780 /libm/powerpc/s_copysign.c | |
parent | 6db179c722192f2ec769f264d8c1e721b26b5e17 (diff) |
Fix naming so things will actually work
-Erik
Diffstat (limited to 'libm/powerpc/s_copysign.c')
-rw-r--r-- | libm/powerpc/s_copysign.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/libm/powerpc/s_copysign.c b/libm/powerpc/s_copysign.c new file mode 100644 index 000000000..18e91998a --- /dev/null +++ b/libm/powerpc/s_copysign.c @@ -0,0 +1,56 @@ +/******************************************************************************* +* * +* File sign.c, * +* Functions copysign and __signbitd. * +* For PowerPC based machines. * +* * +* Copyright © 1991, 2001 Apple Computer, Inc. All rights reserved. * +* * +* Written by Ali Sazegari, started on June 1991. * +* * +* August 26 1991: no CFront Version 1.1d17 warnings. * +* September 06 1991: passes the test suite with invalid raised on * +* signaling nans. sane rom code behaves the same. * +* September 24 1992: took the ̉#include support.hÓ out. * +* Dcember 02 1992: PowerPC port. * +* July 20 1994: __fabs added * +* July 21 1994: deleted unnecessary functions: neg, COPYSIGNnew, * +* and SIGNNUMnew. * +* April 11 2001: first port to os x using gcc. * +* removed fabs and deffered to gcc for direct * +* instruction generation. * +* * +*******************************************************************************/ + +#include "../fp_private.h" + +/******************************************************************************* +* * +* Function copysign. * +* Implementation of copysign for the PowerPC. * +* * +******************************************************************************** +* Note: The order of the operands in this function is reversed from that * +* suggested in the IEEE standard 754. * +*******************************************************************************/ + +double copysign ( double arg2, double arg1 ) + { + union + { + dHexParts hex; + double dbl; + } x, y; + +/******************************************************************************* +* No need to flush NaNs out. * +*******************************************************************************/ + + x.dbl = arg1; + y.dbl = arg2; + + y.hex.high = y.hex.high & 0x7FFFFFFF; + y.hex.high = ( y.hex.high | ( x.hex.high & dSgnMask ) ); + + return y.dbl; + } |