qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 04/23] memory: merge adjacent segments of a s


From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH v2 04/23] memory: merge adjacent segments of a single memory region
Date: Tue, 26 Jul 2011 19:04:50 +0300
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc15 Thunderbird/3.1.11

On 07/26/2011 06:41 PM, Richard Henderson wrote:
On 07/26/2011 04:36 AM, Paolo Bonzini wrote:
>  On 07/26/2011 01:26 PM, Avi Kivity wrote:
>>  +    while (i<  view->nr) {
>>  +        j = i + 1;
>>  +        while (j<  view->nr
>>  +&&  can_merge(&view->ranges[j-1],&view->ranges[j])) {
>>  +            view->ranges[i].addr.size += view->ranges[j].addr.size;
>>  +            ++j;
>>  +        }
>>  +        ++i;
>
>  if (j != i) {
>
>>  +        memmove(&view->ranges[i],&view->ranges[j],
>>  +                (view->nr - j) * sizeof(view->ranges[j]));
>>  +        view->nr -= j - i;
>>  +    }
>
>  }

Err, j = i + 1, and increments.  Your conditional will always be true.


If the while loop body is never executed, then i will equal j (both incremented once).

--
error compiling committee.c: too many arguments to function




reply via email to

[Prev in Thread] Current Thread [Next in Thread]