1 /* flonum_copy.c - copy a flonum
2 Copyright (C) 1987, 1990, 1991 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 1, or (at your option)
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20 /* static const char rcsid[] = "$Id$"; */
25 #define bzero(s,n) memset(s,0,n)
26 #define bcopy(from,to,n) memcpy(to,from,n)
34 int in_length
; /* 0 origin */
35 int out_length
; /* 0 origin */
37 out
-> sign
= in
-> sign
;
38 in_length
= in
-> leader
- in
-> low
;
41 out
-> leader
= out
-> low
- 1; /* 0.0 case */
45 out_length
= out
-> high
- out
-> low
;
47 * Assume no GAPS in packing of littlenums.
48 * I.e. sizeof(array) == sizeof(element) * number_of_elements.
50 if (in_length
<= out_length
)
54 * For defensive programming, zero any high-order littlenums we don't need.
55 * This is destroying evidence and wasting time, so why bother???
57 if (in_length
< out_length
)
59 bzero ((char *)(out
->low
+ in_length
+ 1), out_length
- in_length
);
62 bcopy ((char *)(in
->low
), (char *)(out
->low
), (int)((in_length
+ 1) * sizeof(LITTLENUM_TYPE
)));
63 out
-> exponent
= in
-> exponent
;
64 out
-> leader
= in
-> leader
- in
-> low
+ out
-> low
;
68 int shorten
; /* 1-origin. Number of littlenums we drop. */
70 shorten
= in_length
- out_length
;
71 /* Assume out_length >= 0 ! */
72 bcopy ((char *)(in
->low
+ shorten
),(char *)( out
->low
), (int)((out_length
+ 1) * sizeof(LITTLENUM_TYPE
)));
73 out
-> leader
= out
-> high
;
74 out
-> exponent
= in
-> exponent
+ shorten
;
76 } /* if any significant bits */
79 /* end: flonum_copy.c */
This page took 0.030287 seconds and 4 git commands to generate.