mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:32:46 +00:00 
			
		
		
		
	AK+Everywhere: Replace __builtin bit functions
In order to reduce our reliance on __builtin_{ffs, clz, ctz, popcount},
this commit removes all calls to these functions and replaces them with
the equivalent functions in AK/BuiltinWrappers.h.
			
			
This commit is contained in:
		
							parent
							
								
									26bb3e1acf
								
							
						
					
					
						commit
						08e4a1a4dc
					
				
					 20 changed files with 108 additions and 115 deletions
				
			
		|  | @ -5,6 +5,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <AK/Atomic.h> | ||||
| #include <AK/BuiltinWrappers.h> | ||||
| #include <AK/OwnPtr.h> | ||||
| #include <AK/RefPtr.h> | ||||
| #include <AK/Types.h> | ||||
|  | @ -185,12 +186,12 @@ RefPtr<StorageDevice> AHCIController::device(u32 index) const | |||
| { | ||||
|     NonnullRefPtrVector<StorageDevice> connected_devices; | ||||
|     u32 pi = hba().control_regs.pi; | ||||
|     u32 bit = __builtin_ffsl(pi); | ||||
|     u32 bit = bit_scan_forward(pi); | ||||
|     while (bit) { | ||||
|         dbgln_if(AHCI_DEBUG, "Checking implemented port {}, pi {:b}", bit - 1, pi); | ||||
|         pi &= ~(1u << (bit - 1)); | ||||
|         auto checked_device = device_by_port(bit - 1); | ||||
|         bit = __builtin_ffsl(pi); | ||||
|         bit = bit_scan_forward(pi); | ||||
|         if (checked_device.is_null()) | ||||
|             continue; | ||||
|         connected_devices.append(checked_device.release_nonnull()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Nick Johnson
						Nick Johnson