mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
exec.c: add a check between constants to see whether we could skip
The maximum level is defined as P_L2_LEVELS and skip is defined with 6 bits, which means if P_L2_LEVELS < (1 << 6), skip never exceeds the boundary. Since this check is between two constants, which leverages compiler to optimize the code based on different configuration. Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> Message-Id: <20190321082555.21118-7-richardw.yang@linux.intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
26ca2075ba
commit
526ca2360e
1 changed files with 2 additions and 1 deletions
3
exec.c
3
exec.c
|
@ -324,7 +324,8 @@ static void phys_page_compact(PhysPageEntry *lp, Node *nodes)
|
||||||
assert(valid_ptr < P_L2_SIZE);
|
assert(valid_ptr < P_L2_SIZE);
|
||||||
|
|
||||||
/* Don't compress if it won't fit in the # of bits we have. */
|
/* Don't compress if it won't fit in the # of bits we have. */
|
||||||
if (lp->skip + p[valid_ptr].skip >= (1 << 6)) {
|
if (P_L2_LEVELS >= (1 << 6) &&
|
||||||
|
lp->skip + p[valid_ptr].skip >= (1 << 6)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue