ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/mgflib/3ds2mgf.c
(Generate patch)

Comparing ray/src/cv/mgflib/3ds2mgf.c (file contents):
Revision 1.9 by greg, Wed Sep 5 02:41:19 2007 UTC vs.
Revision 1.10 by greg, Mon Nov 10 19:08:18 2008 UTC

# Line 2950 | Line 2950 | dword read_dword()
2950  
2951   float read_float()
2952   {
2953 +    union { dword i; char c[8]; } u;
2954      dword data;
2955  
2956      data = read_dword();
2957  
2958 <    return *(float *)&data;
2958 >    if (sizeof(dword) == sizeof(float))
2959 >        return *(float *)&data;
2960 >
2961 >    u.i = 1;
2962 >    if (u.c[0] == 0)
2963 >        return *(float *)&data; /* assume big-endian */
2964 >
2965 >    if (sizeof(dword) != 2*sizeof(float)) {
2966 >        fputs("Unsupported word length\n", stderr);
2967 >        exit(1);
2968 >    }
2969 >    u.i = data;
2970 >    return *(float *)&u.c[4];
2971   }
2972  
2973  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines