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

Comparing ray/src/common/calexpr.c (file contents):
Revision 2.34 by greg, Sun Jul 25 05:50:27 2010 UTC vs.
Revision 2.35 by greg, Sat Sep 4 19:04:35 2010 UTC

# Line 619 | Line 619 | getE2(void)                    /* E2 -> E2 MULOP E3 */
619                  EPNODE  *ep3 = ep1->sibling;
620                  if (ep1->type == NUM && ep3->type == NUM) {
621                          ep2 = rconst(ep2);
622 <                } else if (ep3->type == NUM && ep3->v.num == 0) {
623 <                        if (ep2->type == '/')
624 <                                syntax("divide by zero constant");
625 <                        ep1->sibling = NULL;    /* (E2 * 0) */
626 <                        epfree(ep2);
627 <                        ep2 = ep3;
622 >                } else if (ep3->type == NUM) {
623 >                        if (ep2->type == '/') {
624 >                                if (ep3->v.num == 0)
625 >                                        syntax("divide by zero constant");
626 >                                ep2->type = '*';        /* for speed */
627 >                                ep3->v.num = 1./ep3->v.num;
628 >                        } else if (ep3->v.num == 0) {
629 >                                ep1->sibling = NULL;    /* (E2 * 0) */
630 >                                epfree(ep2);
631 >                                ep2 = ep3;
632 >                        }
633                  } else if (ep1->type == NUM && ep1->v.num == 0) {
634                          epfree(ep3);            /* (0 * E3) or (0 / E3) */
635                          ep1->sibling = NULL;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines