Mercurial > hg > CbC > old > device
comparison mc-parse.c @ 436:d92786033042 loprtc-div
loprtc
author | kono |
---|---|
date | Sun, 14 Nov 2004 15:41:05 +0900 |
parents | fb136af3bf09 |
children | 626d705471d5 |
comparison
equal
deleted
inserted
replaced
435:d3e6359f8501 | 436:d92786033042 |
---|---|
2567 } | 2567 } |
2568 #endif | 2568 #endif |
2569 #if LONGLONG_CODE | 2569 #if LONGLONG_CODE |
2570 if(type==LONGLONG||type==ULONGLONG) { | 2570 if(type==LONGLONG||type==ULONGLONG) { |
2571 // return list2(LMINUS,e); | 2571 // return list2(LMINUS,e); |
2572 return(car(e)==LCONST?llist2(LCONST,-lcadr(e)):list2(LMINUS,e)); | 2572 if (car(e)==LCONST) { |
2573 if (lcadr(e)>0 && type==ULONGLONG) { type=LONGLONG; | |
2574 } else if (lcadr(e)<=0 && type==LONGLONG) { type=ULONGLONG; | |
2575 } | |
2576 return llist2(LCONST,-lcadr(e)); | |
2577 } | |
2578 return list2(LMINUS,e); | |
2573 } | 2579 } |
2574 #endif | 2580 #endif |
2575 if(!integral(type)) | 2581 if(!integral(type)) |
2576 error(TYERR); | 2582 error(TYERR); |
2577 return(car(e)==CONST?list2(CONST,-cadr(e)):list2(MINUS,e)); | 2583 if (car(e)==CONST) { |
2584 if (cadr(e)>0 && type==UNSIGNED) { type=INT; | |
2585 } if (cadr(e)<=0 && type==INT) { type=UNSIGNED; | |
2586 } | |
2587 return list2(CONST,-cadr(e)); | |
2588 } | |
2589 return list2(MINUS,e); | |
2578 case BNOT: /* ~p */ | 2590 case BNOT: /* ~p */ |
2579 conv->prefix_(sym); | 2591 conv->prefix_(sym); |
2580 getsym(0); | 2592 getsym(0); |
2581 e=rvalue(expr13()); | 2593 e=rvalue(expr13()); |
2582 // LONGLONG? | 2594 // LONGLONG? |
2799 type=list3(ARRAY,CHAR,nptr->dsp); | 2811 type=list3(ARRAY,CHAR,nptr->dsp); |
2800 getsym(0); | 2812 getsym(0); |
2801 break; | 2813 break; |
2802 case CONST: | 2814 case CONST: |
2803 conv-> const_(symval); | 2815 conv-> const_(symval); |
2804 type= INT; | 2816 type= symval>=0?UNSIGNED:INT; |
2805 e1=list2(CONST,symval); | 2817 e1=list2(CONST,symval); |
2806 getsym(0); | 2818 getsym(0); |
2807 break; | 2819 break; |
2808 #if FLOAT_CODE | 2820 #if FLOAT_CODE |
2809 case FCONST: | 2821 case FCONST: |
2820 break; | 2832 break; |
2821 #endif | 2833 #endif |
2822 #if LONGLONG_CODE | 2834 #if LONGLONG_CODE |
2823 case LCONST: | 2835 case LCONST: |
2824 conv-> const_(symval); | 2836 conv-> const_(symval); |
2825 type= LONGLONG; | 2837 type= ULONGLONG; |
2826 e1=llist2(LCONST,lsymval); | 2838 e1=llist2(LCONST,lsymval); |
2827 getsym(0); | 2839 getsym(0); |
2828 break; | 2840 break; |
2829 #endif | 2841 #endif |
2830 case RETURN: | 2842 case RETURN: |