Uninitialized vector entry?
[minix3.git] / lib / float / cuf8.c
blobd18ec6c7a8cebb4152cd19a3e9d4a83f886dbfd2
1 /*
2 (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 See the copyright notice in the ACK home directory, in the file "Copyright".
4 */
6 /* $Header$ */
8 /*
9 CONVERT INTEGER TO FLOAT (CUF n 8)
11 THIS ROUTINE WORKS BY FILLING AN EXTENDED
12 WITH THE INTEGER VALUE IN EXTENDED FORMAT
13 AND USES COMPACT() TO PUT IT INTO THE PROPER
14 FLOATING POINT PRECISION.
17 #include "FP_types.h"
19 void
20 cuf8(ss,src)
21 int ss; /* source size */
22 long src; /* largest possible integer to convert */
24 EXTEND buf;
25 short *ipt;
26 long i_src;
28 zrf_ext(&buf);
29 if (ss == sizeof(long)) {
30 buf.exp = 31;
31 i_src = src;
33 else {
34 ipt = (short *) &src;
35 i_src = (long) *ipt;
36 buf.exp = 15;
38 if (i_src == 0) {
39 zrf8((DOUBLE *)((void *)&ss));
40 return;
42 /* ESTABLISHED THAT src != 0 */
44 /* adjust exponent field */
45 if (ss != sizeof(long))
46 i_src <<= 16;
48 /* move to mantissa field */
49 buf.m1 = i_src;
51 /* adjust mantissa field */
52 nrm_ext(&buf);
53 compact(&buf,(unsigned long *) (void *)&ss,8);