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.23 by greg, Fri Jan 15 18:31:38 2021 UTC vs.
Revision 2.24 by greg, Fri Feb 19 02:59:32 2021 UTC

# Line 33 | Line 33 | putint(                                /* write a siz-byte integer to fp */
33          FILE  *fp
34   )
35   {
36 +        while (siz > sizeof(long)) {
37 +                putc((i<0)*0xff, fp);
38 +                siz--;
39 +        }
40          siz <<= 3;
41          while ((siz -= 8) > 0)
42                  putc((int)(i>>siz & 0xff), fp);
# Line 112 | Line 116 | getint(                                /* get a siz-byte integer */
116  
117          if ((c = getc(fp)) == EOF)
118                  return(EOF);
119 <        r = 0x80&c ? -1<<8|c : c;               /* sign extend */
119 >        r = c;
120 >        if (c & 0x80)           /* sign extend? */
121 >                r |= ~255L;
122          while (--siz > 0) {
123                  if ((c = getc(fp)) == EOF)
124                          return(EOF);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines