[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3] virtio-blk: trivial code optimization
From: |
Gonglei |
Subject: |
Re: [Qemu-devel] [PATCH v3] virtio-blk: trivial code optimization |
Date: |
Wed, 11 Nov 2015 09:53:59 +0800 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 2015/11/10 17:56, Stefan Hajnoczi wrote:
> The C99 standard says:
>
> 6.3.1.1 Boolean, characters, and integers
>
> - The rank of a signed integer type shall be greater than the rank of
> any signed integer type with less precision.
>
> ...
>
> - The rank of any unsigned integer type shall equal the rank of the
> corresponding signed integer type, if any.
>
> 6.3.1.8 Usual arithmetic conversions
>
> Otherwise, if the operand that has unsigned integer type has rank
> greater or equal to the rank of the type of the other operand, then the
> operand with signed integer type is converted to the type of the operand
> with unsigned integer type.
>
> So the max_xfer_len int operand must be converted to the higher ranking
> unsigned long long.
>
Thank you so much, it's clear. I'll add a check before subtraction.
Please review v4.
Regards,
-Gonglei