mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	libxfs: Optimize the loop for xfs_bitmap_empty
If there is any non zero bit in a long bitmap, it can jump out of the loop and finish the function as soon as possible. Signed-off-by: Jia He <hejianet@gmail.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
		
							parent
							
								
									168309855a
								
							
						
					
					
						commit
						1d4292bfdc
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -32,13 +32,13 @@ int
 | 
			
		|||
xfs_bitmap_empty(uint *map, uint size)
 | 
			
		||||
{
 | 
			
		||||
	uint i;
 | 
			
		||||
	uint ret = 0;
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < size; i++) {
 | 
			
		||||
		ret |= map[i];
 | 
			
		||||
		if (map[i] != 0)
 | 
			
		||||
			return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return (ret == 0);
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue