[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] blockjob: avoid 32-bit compilation warning



On 09/08/14 17:43, Eric Blake wrote:
> On 09/08/2014 08:55 AM, Eric Blake wrote:
> 
>> Forcing the left side of the < to be ull instead of ul shuts up
>> the 32-bit compiler while still protecting 64-bit code from overflow.
> 
>>                   * ullong bytes/s; make sure we don't overflow */
>> -                if (bandwidth > ULLONG_MAX >> 20) {
>> +                if (bandwidth + 0ULL > ULLONG_MAX >> 20) {
> 
> On IRC, several people suggested that I write this with an explicit cast:
> 
> if ((unsigned long long) bandwidth > ULLONG_MAX >> 20) {
> 
> rather than my shorthand of an identity operation used to coerce types
> via promotion rules.  If you feel strongly in favor of one of the two
> approaches, or strongly about avoiding needless churn now that the patch
> is already pushed, speak up now; if not, I'll probably make the change
> to use an explicit cast later today.
>
I don't think it's worth fixing up since it's pushed already.

Peter


Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]