mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	host1x/syncpoint_manager: Eliminate unnecessary std::function construction
We can just pass the function object through, and if it's a valid function, then it will automatically be converted.
This commit is contained in:
		@@ -36,16 +36,14 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    template <typename Func>
 | 
					    template <typename Func>
 | 
				
			||||||
    ActionHandle RegisterGuestAction(u32 syncpoint_id, u32 expected_value, Func&& action) {
 | 
					    ActionHandle RegisterGuestAction(u32 syncpoint_id, u32 expected_value, Func&& action) {
 | 
				
			||||||
        std::function<void()> func(action);
 | 
					 | 
				
			||||||
        return RegisterAction(syncpoints_guest[syncpoint_id], guest_action_storage[syncpoint_id],
 | 
					        return RegisterAction(syncpoints_guest[syncpoint_id], guest_action_storage[syncpoint_id],
 | 
				
			||||||
                              expected_value, std::move(func));
 | 
					                              expected_value, std::move(action));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    template <typename Func>
 | 
					    template <typename Func>
 | 
				
			||||||
    ActionHandle RegisterHostAction(u32 syncpoint_id, u32 expected_value, Func&& action) {
 | 
					    ActionHandle RegisterHostAction(u32 syncpoint_id, u32 expected_value, Func&& action) {
 | 
				
			||||||
        std::function<void()> func(action);
 | 
					 | 
				
			||||||
        return RegisterAction(syncpoints_host[syncpoint_id], host_action_storage[syncpoint_id],
 | 
					        return RegisterAction(syncpoints_host[syncpoint_id], host_action_storage[syncpoint_id],
 | 
				
			||||||
                              expected_value, std::move(func));
 | 
					                              expected_value, std::move(action));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void DeregisterGuestAction(u32 syncpoint_id, const ActionHandle& handle);
 | 
					    void DeregisterGuestAction(u32 syncpoint_id, const ActionHandle& handle);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user