OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [linux/] [uClibc/] [libm/] [powerpc/] [s_copysign.c] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/*******************************************************************************
2
*                                                                              *
3
*      File sign.c,                                                            *
4
*      Functions copysign and __signbitd.                                                    *
5
*      For PowerPC based machines.                                             *
6
*                                                                              *
7
*      Copyright © 1991, 2001 Apple Computer, Inc.  All rights reserved.       *
8
*                                                                              *
9
*      Written by Ali Sazegari, started on June 1991.                          *
10
*                                                                              *
11
*      August    26 1991: no CFront Version 1.1d17 warnings.                   *
12
*      September 06 1991: passes the test suite with invalid raised on         *
13
*                         signaling nans.  sane rom code behaves the same.     *
14
*      September 24 1992: took the ̉#include support.hÓ out.                   *
15
*      Dcember   02 1992: PowerPC port.                                        *
16
*      July      20 1994: __fabs added                                         *
17
*      July      21 1994: deleted unnecessary functions: neg, COPYSIGNnew,     *
18
*                         and SIGNNUMnew.                                      *
19
*        April     11 2001: first port to os x using gcc.                                *
20
*                                 removed fabs and deffered to gcc for direct          *
21
*                                 instruction generation.                                        *
22
*                                                                              *
23
*******************************************************************************/
24
 
25
#include "../fp_private.h"
26
 
27
/*******************************************************************************
28
*                                                                              *
29
*     Function copysign.                                                       *
30
*     Implementation of copysign for the PowerPC.                              *
31
*                                                                              *
32
********************************************************************************
33
*     Note: The order of the operands in this function is reversed from that   *
34
*     suggested in the IEEE standard 754.                                      *
35
*******************************************************************************/
36
 
37
double copysign ( double arg2, double arg1 )
38
      {
39
      union
40
            {
41
            dHexParts hex;
42
            double dbl;
43
            } x, y;
44
 
45
/*******************************************************************************
46
*     No need to flush NaNs out.                                               *
47
*******************************************************************************/
48
 
49
      x.dbl = arg1;
50
      y.dbl = arg2;
51
 
52
      y.hex.high = y.hex.high & 0x7FFFFFFF;
53
      y.hex.high = ( y.hex.high | ( x.hex.high & dSgnMask ) );
54
 
55
      return y.dbl;
56
      }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.