mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Gaohaifeng (A)" <gaohaifeng.gao@huawei.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stephan.baerwolf@tu-ilmenau.de" <stephan.baerwolf@tu-ilmenau.de>,
	"Huangjian (J)" <huangjian.huangjian@huawei.com>
Subject: Re: sched:  about vruntime overflow
Date: Tue, 7 Jul 2015 11:10:29 +0200	[thread overview]
Message-ID: <20150707091029.GP3644@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <47CEA9C0E570484FBF22EF0D7EBCE5B534B17A98@szxema505-mbs.china.huawei.com>

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;
> }


       reply	other threads:[~2015-07-07  9:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <47CEA9C0E570484FBF22EF0D7EBCE5B534B17A98@szxema505-mbs.china.huawei.com>
2015-07-07  9:10 ` Peter Zijlstra [this message]
2015-07-07  9:18   ` Gaohaifeng (A)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150707091029.GP3644@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=gaohaifeng.gao@huawei.com \
    --cc=huangjian.huangjian@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stephan.baerwolf@tu-ilmenau.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®