>>> On 25.04.18 at 12:06, <wei.l...@citrix.com> wrote:
> On Wed, Apr 25, 2018 at 11:04:26AM +0200, Olaf Hering wrote:
>> Am Wed, 25 Apr 2018 09:59:23 +0100
>> schrieb Wei Liu <wei.l...@citrix.com>:
>> 
>> > Do you have the full diff of your changes? 
>> 
>> Not right now. But without 'val', or val being uint, the same error happens 
> in f():
>> 
>> #include <stdio.h>
>> void f(void)
>> {
>>         unsigned short req_prod = 0, req_cons = 65400;
>>         unsigned short val;
>>         val = req_prod - req_cons;
>>         printf("req_prod - req_cons %u\n", val);
>>         printf("req_prod - req_cons %x\n", val);
>> }
> 
> What Jan said.
> 
> Integer promotion makes unsigned short into unsigned int first then do
> the calculation.

Not exactly - it promotes to plain (i.e. signed) int.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to