mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-25 17:26:56 +00:00
exec.c: get nodes_nb_alloc with one MAX calculation
The purpose of these two MAX here is to get the maximum of these three variables: A: map->nodes_nb + nodes B: map->nodes_nb_alloc C: alloc_hint We can write it like MAX(A, B, C). Since the if condition says A > B, this means MAX(A, B, C) = MAX(A, C). This patch just simplify the calculation a bit. Backports commit c95cfd040078db8017f74fd3a4d6f798385d960c from qemu
This commit is contained in:
parent
4274315278
commit
ef3cf096e7
|
@ -150,8 +150,7 @@ static void tcg_commit(MemoryListener *listener);
|
|||
static void phys_map_node_reserve(struct uc_struct *uc, PhysPageMap *map, unsigned nodes)
|
||||
{
|
||||
if (map->nodes_nb + nodes > map->nodes_nb_alloc) {
|
||||
map->nodes_nb_alloc = MAX(map->nodes_nb_alloc, uc->phys_map_node_alloc_hint);
|
||||
map->nodes_nb_alloc = MAX(map->nodes_nb_alloc, map->nodes_nb + nodes);
|
||||
map->nodes_nb_alloc = MAX(uc->phys_map_node_alloc_hint, map->nodes_nb + nodes);
|
||||
map->nodes = g_renew(Node, map->nodes, map->nodes_nb_alloc);
|
||||
uc->phys_map_node_alloc_hint = map->nodes_nb_alloc;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue