ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/portio.c
(Generate patch)

Comparing ray/src/common/portio.c (file contents):
Revision 2.1 by greg, Mon Jul 13 15:36:01 1992 UTC vs.
Revision 2.4 by greg, Fri Nov 15 16:17:05 1996 UTC

# Line 10 | Line 10 | static char SCCSid[] = "$SunId$ LBL";
10  
11   #include <stdio.h>
12  
13 + #ifndef frexp
14 + extern double  frexp();
15 + #endif
16 + #ifndef ldexp
17 + extern double  ldexp();
18 + #endif
19  
20 +
21   putstr(s, fp)                   /* write null-terminated string to fp */
22   register char  *s;
23   register FILE  *fp;
# Line 27 | Line 34 | register int  siz;
34   register FILE  *fp;
35   {
36          while (siz--)
37 <                putc(i>>(siz<<3) & 0xff, fp);
37 >                putc((int)(i>>(siz<<3) & 0xff), fp);
38   }
39  
40  
41   putflt(f, fp)                   /* put out floating point number */
42 < double  f;
42 > double  f;
43 > FILE  *fp;
44   {
37        extern double  frexp();
45          int  e;
46  
47          putint((long)(frexp(f,&e)*0x7fffffff), 4, fp);
# Line 84 | Line 91 | double
91   getflt(fp)                      /* get a floating point number */
92   FILE  *fp;
93   {
94 <        extern double  ldexp();
88 <        double  d;
94 >        double  d;
95  
96 <        d = (double)getint(4, fp)/0x7fffffff;
96 >        d = (getint(4, fp) + .5) / 0x7fffffff;
97          return(ldexp(d, (int)getint(1, fp)));
98   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines