Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.158
 
1.159
 
MAIN:ragge:20070801045546
 
trees.c
_>164164 
 165165                 switch( o ){
 166166 
<> 167+                case PLUS:
  168+                case MINUS:
  169+                case MUL:
  170+                case DIV:
  171+                case MOD:
  172+                        /*
  173+                         * Do type propagation for simple types here.
  174+                         * The constant value is correct anyway.
  175+                         * Maybe this op shortcut should be removed?
  176+                         */
  177+                        if (l->n_sp == NULL && r->n_sp == NULL &&
  178+                            l->n_type < BTMASK && r->n_type < BTMASK) {
  179+                                if (l->n_type > r->n_type)
  180+                                        r->n_type = l->n_type;
  181+                                else
  182+                                        l->n_type = r->n_type;
  183+                        }
  184+                        /* FALLTHROUGH */
167185                 case ULT:
 168186                 case UGT:
 169187                 case ULE:
     
 !
176194                 case NE:
 177195                 case ANDAND:
 178196                 case OROR:
<>179 -                case PLUS:
 180 -                case MINUS:
 181 -                case MUL:
 182 -                case DIV:
 183 -                case MOD:
184197                 case AND:
 185198                 case OR:
 186199                 case ER:
     
 !
569582 {
 570583         int i, u;
 571584         CONSZ val;
<> 585+        U_CONSZ v1, v2;
572586 
 573587         val = q->n_lval;
 574588         u = ISUNSIGNED(p->n_type) || ISUNSIGNED(q->n_type);
     
 !
580594                 return(0);
 581595         if (p->n_sp != NULL && o != PLUS && o != MINUS)
 582596                 return(0);
<>583 -
  597+        if (u) {
  598+                v1 = p->n_lval;
  599+                v2 = q->n_lval;
  600+        }
584601         switch( o ){
 585602 
 586603         case PLUS:
     
 !
599616         case DIV:
 600617                 if (val == 0)
 601618                         uerror("division by 0");
<>602 -                else
 603 -                        p->n_lval /= val;
  619+                else  {
  620+                        if (u) {
  621+                                v1 /= v2;
  622+                                p->n_lval = v1;
  623+                        } else
  624+                                p->n_lval /= val;
  625+                }
604626                 break;
 605627         case MOD:
 606628                 if (val == 0)
 607629                         uerror("division by 0");
<>608 -                else
 609 -                        p->n_lval %= val;
  630+                else  {
  631+                        if (u) {
  632+                                v1 %= v2;
  633+                                p->n_lval = v1;
  634+                        } else
  635+                                p->n_lval %= val;
  636+                }
610637                 break;
 611638         case AND:
 612639                 p->n_lval &= val;
     
 !
623650                 break;
 624651         case RS:
 625652                 i = val;
<>626 -                p->n_lval = p->n_lval >> i;
  653+                if (u) {
  654+                        v1 = v1 >> i;
  655+                        p->n_lval = v1;
  656+                } else
  657+                        p->n_lval = p->n_lval >> i;
627658                 break;
 628659 
 629660         case UMINUS:
     
 !
648679                 p->n_lval = p->n_lval >= val;
 649680                 break;
 650681         case ULT:
<>651 -                p->n_lval = (p->n_lval-val)<0;
  682+                p->n_lval = v1 < v2;
652683                 break;
 653684         case ULE:
<>654 -                p->n_lval = (p->n_lval-val)<=0;
  685+                p->n_lval = v1 <= v2;
655686                 break;
 656687         case UGT:
<>657 -                p->n_lval = (p->n_lval-val)>=0;
  688+                p->n_lval = v1 > v2;
658689                 break;
 659690         case UGE:
<>660 -                p->n_lval = (p->n_lval-val)>0;
  691+                p->n_lval = v1 >= v2;
661692                 break;
 662693         case EQ:
 663694                 p->n_lval = p->n_lval == val;
     
 !
12121243                 }
 12131244 
 12141245 #ifdef PCC_DEBUG
<>1215 -        if (tdebug)
 1216 -                printf("tymatch(%p): %o %s %o => %o\n",p,t1,copst(o),t2,tu );
  1246+        if (tdebug) {
  1247+                printf("tymatch(%p): ", p);
  1248+                tprint(stdout, t1, 0);
  1249+                printf(" %s ", copst(o));
  1250+                tprint(stdout, t2, 0);
  1251+                printf(" => ");
  1252+                tprint(stdout, tu, 0);
  1253+                printf("\n");
  1254+        }
<_12171255 #endif
 12181256 
 12191257         return(p);
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-08-22 09:53 +0200