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.3 by greg, Fri Oct 2 16:09:57 1992 UTC vs.
Revision 2.9 by greg, Thu Nov 13 16:42:17 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Portable i/o for binary files
6 + *
7 + * External symbols declared in standard.h
8   */
9  
10 + #include "copyright.h"
11 +
12   #include <stdio.h>
13  
14 < #ifndef frexp
14 < extern double  frexp();
15 < #endif
16 < #ifndef ldexp
17 < extern double  ldexp();
18 < #endif
14 > #include "rtio.h"
15  
16 + #include <math.h>
17  
18 +
19 + void
20   putstr(s, fp)                   /* write null-terminated string to fp */
21   register char  *s;
22   register FILE  *fp;
# Line 28 | Line 27 | register FILE  *fp;
27   }
28  
29  
30 + void
31   putint(i, siz, fp)              /* write a siz-byte integer to fp */
32   long  i;
33   register int  siz;
# Line 38 | Line 38 | register FILE  *fp;
38   }
39  
40  
41 + void
42   putflt(f, fp)                   /* put out floating point number */
43   double  f;
44   FILE  *fp;
# Line 91 | Line 92 | double
92   getflt(fp)                      /* get a floating point number */
93   FILE  *fp;
94   {
95 +        long    l;
96          double  d;
97  
98 <        d = (double)getint(4, fp)/0x7fffffff;
98 >        l = getint(4, fp);
99 >        d = (l + (l > 0 ? .5 : -.5)) * (1./0x7fffffff);
100          return(ldexp(d, (int)getint(1, fp)));
101   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines