[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 7 Jul 2015 11:10:29 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: "Gaohaifeng (A)" <gaohaifeng.gao@...wei.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stephan.baerwolf@...ilmenau.de" <stephan.baerwolf@...ilmenau.de>,
"Huangjian (J)" <huangjian.huangjian@...wei.com>
Subject: Re: sched: about vruntime overflow
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;
> }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists