mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-08 22:15:28 +00: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. Backports commit 526ca2360ea1cd947f74c8c6c38b91b9d6fcfdb5 from qemu
This commit is contained in:
parent
623632f3ac
commit
813ec29d3c
|
@ -247,7 +247,8 @@ static void phys_page_compact(PhysPageEntry *lp, Node *nodes, unsigned long *com
|
|||
assert(valid_ptr < P_L2_SIZE);
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue