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.7 by greg, Tue Feb 25 02:47:21 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
# Line 18 | Line 19 | extern double  ldexp();
19   #endif
20  
21  
22 + void
23   putstr(s, fp)                   /* write null-terminated string to fp */
24   register char  *s;
25   register FILE  *fp;
# Line 28 | Line 30 | register FILE  *fp;
30   }
31  
32  
33 + void
34   putint(i, siz, fp)              /* write a siz-byte integer to fp */
35   long  i;
36   register int  siz;
# Line 38 | Line 41 | register FILE  *fp;
41   }
42  
43  
44 + void
45   putflt(f, fp)                   /* put out floating point number */
46   double  f;
47   FILE  *fp;
# Line 91 | Line 95 | double
95   getflt(fp)                      /* get a floating point number */
96   FILE  *fp;
97   {
98 +        long    l;
99          double  d;
100  
101 <        d = (double)getint(4, fp)/0x7fffffff;
101 >        l = getint(4, fp);
102 >        d = (l + (l > 0 ? .5 : -.5)) * (1./0x7fffffff);
103          return(ldexp(d, (int)getint(1, fp)));
104   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines