mirror of
				https://github.com/GrapheneOS/hardened_malloc.git
				synced 2025-10-31 03:38:55 -04:00 
			
		
		
		
	simplify get_free_slot loops
This commit is contained in:
		
							parent
							
								
									a02f4ebb19
								
							
						
					
					
						commit
						ceffb1a0ec
					
				
					 1 changed files with 4 additions and 8 deletions
				
			
		
							
								
								
									
										12
									
								
								malloc.c
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								malloc.c
									
										
									
									
									
								
							|  | @ -271,11 +271,9 @@ static size_t get_free_slot(struct random_state *rng, size_t slots, struct slab_ | |||
|                 masked |= random_split; | ||||
|             } | ||||
| 
 | ||||
|             if (masked == ~0UL) { | ||||
|                 continue; | ||||
|             if (masked != ~0UL) { | ||||
|                 return ffzl(masked) - 1 + i * 64; | ||||
|             } | ||||
| 
 | ||||
|             return ffzl(masked) - 1 + i * 64; | ||||
|         } | ||||
|    } | ||||
| 
 | ||||
|  | @ -285,11 +283,9 @@ static size_t get_free_slot(struct random_state *rng, size_t slots, struct slab_ | |||
|             masked |= get_mask(slots - i * 64); | ||||
|         } | ||||
| 
 | ||||
|         if (masked == ~0UL) { | ||||
|             continue; | ||||
|         if (masked != ~0UL) { | ||||
|             return ffzl(masked) - 1 + i * 64; | ||||
|         } | ||||
| 
 | ||||
|         return ffzl(masked) - 1 + i * 64; | ||||
|     } | ||||
| 
 | ||||
|     fatal_error("no zero bits"); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Daniel Micay
						Daniel Micay