mirror of
				https://github.com/qemu/qemu.git
				synced 2025-10-31 12:07:31 +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.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190321082555.21118-4-richardw.yang@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
			
			
This commit is contained in:
		
							parent
							
								
									56b1507680
								
							
						
					
					
						commit
						c95cfd0400
					
				
							
								
								
									
										3
									
								
								exec.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								exec.c
									
									
									
									
									
								
							| @ -227,8 +227,7 @@ static void phys_map_node_reserve(PhysPageMap *map, unsigned nodes) | ||||
| { | ||||
|     static unsigned alloc_hint = 16; | ||||
|     if (map->nodes_nb + nodes > map->nodes_nb_alloc) { | ||||
|         map->nodes_nb_alloc = MAX(map->nodes_nb_alloc, alloc_hint); | ||||
|         map->nodes_nb_alloc = MAX(map->nodes_nb_alloc, map->nodes_nb + nodes); | ||||
|         map->nodes_nb_alloc = MAX(alloc_hint, map->nodes_nb + nodes); | ||||
|         map->nodes = g_renew(Node, map->nodes, map->nodes_nb_alloc); | ||||
|         alloc_hint = map->nodes_nb_alloc; | ||||
|     } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Wei Yang
						Wei Yang