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

Comparing ray/src/util/radcompare.c (file contents):
Revision 2.19 by greg, Wed Aug 14 04:18:12 2019 UTC vs.
Revision 2.20 by greg, Wed Aug 14 18:20:02 2019 UTC

# Line 99 | Line 99 | char           *progname = NULL;
99   const char      stdin_name[] = "<stdin>";
100   const char      *f1name=NULL, *f2name=NULL;
101   FILE            *f1in=NULL, *f2in=NULL;
102 + int             f1swap=0, f2swap=0;
103  
104                                  /* running real differences */
105   double  diff2sum = 0;
# Line 325 | Line 326 | setheadvar(char *val, void *p)
326          adv_linecnt(htp);       /* side-effect is to count lines */
327          if (!isalpha(*val))     /* key must start line */
328                  return(0);
329 +                                /* check if we need to swap binary data */
330 +        if ((n = isbigendian(val)) >= 0) {
331 +                if (nativebigendian() == n)
332 +                        return(0);
333 +                f1swap += (htp == &hdr1);
334 +                f2swap += (htp == &hdr2);
335 +                return(0);
336 +        }
337          key = val++;
338          while (*val && !isspace(*val) & (*val != '='))
339                  val++;
# Line 822 | Line 831 | compare_float()
831                  if (!getbinary(&f2, sizeof(f2), 1, f2in))
832                          goto badeof;
833                  ++nread;
834 +                if (f1swap) swap32((char *)&f1, 1);
835 +                if (f2swap) swap32((char *)&f2, 1);
836                  if (real_check(f1, f2))
837                          continue;
838                  if (report != REP_QUIET)
# Line 852 | Line 863 | compare_double()
863                  if (!getbinary(&f2, sizeof(f2), 1, f2in))
864                          goto badeof;
865                  ++nread;
866 +                if (f1swap) swap64((char *)&f1, 1);
867 +                if (f2swap) swap64((char *)&f2, 1);
868                  if (real_check(f1, f2))
869                          continue;
870                  if (report != REP_QUIET)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines