[libvirt] [PATCH] blockjob: avoid 32-bit compilation warning
Peter Krempa
pkrempa at redhat.com
Mon Sep 8 15:45:25 UTC 2014
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140908/e7d79b5e/attachment-0001.sig>
More information about the libvir-list
mailing list