Messages in this thread | | | From | "Gaohaifeng (A)" <> | Subject | RE: sched: about vruntime overflow | Date | Tue, 7 Jul 2015 09:18:36 +0000 |
| |
Much Thanks!
On Tue, Jul 07, 2015 at 08:05:50AM +0000, Gaohaifeng (A) wrote: > int main() > { > unsigned char a,b; > a=251; > b=254; > b +=5; // b will overflow > printf("a=%u \n",a); > printf("b=%u \n",b); > printf("(a-b<0)=%d\n",(a-b)<0);
If you look at entity_before() you'll notice that the correct statement would be:
printf("(a-b<0)=%d\n",(signed char)(a-b)<0);
> printf("(a-b<0)=%d\n",((unsigned char)(a-250)-(unsigned char)(b-250)<0)); > return 0; > }
| |