--- ray/src/common/dircode.c 2003/03/04 05:49:21 2.1 +++ ray/src/common/dircode.c 2003/06/20 00:25:49 2.5 @@ -1,8 +1,10 @@ #ifndef lint -static const char RCSid[] = "$Id: dircode.c,v 2.1 2003/03/04 05:49:21 greg Exp $"; +static const char RCSid[] = "$Id: dircode.c,v 2.5 2003/06/20 00:25:49 greg Exp $"; #endif /* - * Compute 4-byte direction code (assume this fits into int) + * Compute a 4-byte direction code (int32 type defined in standard.h). + * + * Mean accuracy is 0.0022 degrees, with a maximum error of 0.0058 degrees. */ #include "standard.h" @@ -17,20 +19,20 @@ static const char RCSid[] = "$Id: dircode.c,v 2.1 2003 #define F2SFT 18 #define FMASK 0x1fff -int4 +int32 encodedir(dv) /* encode a normalized direction vector */ FVECT dv; { - register int4 dc = 0; + register int32 dc = 0; int cd[3], cm; register int i; for (i = 0; i < 3; i++) if (dv[i] < 0.) { - cd[i] = dv[i] * -DCSCALE; + cd[i] = (int)(dv[i] * -DCSCALE); dc |= FXNEG<