mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	core_timing: Use transparent functors where applicable
Gets rid of the need to hardcode the type in multiple places. This will now be deduced automatically, based off the elements in the container being provided to the algorithm.
This commit is contained in:
		
							parent
							
								
									5e658efdb8
								
							
						
					
					
						commit
						196ab8be89
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		|  | @ -142,7 +142,7 @@ void ScheduleEvent(s64 cycles_into_future, const EventType* event_type, u64 user | ||||||
|         ForceExceptionCheck(cycles_into_future); |         ForceExceptionCheck(cycles_into_future); | ||||||
| 
 | 
 | ||||||
|     event_queue.emplace_back(Event{timeout, event_fifo_id++, userdata, event_type}); |     event_queue.emplace_back(Event{timeout, event_fifo_id++, userdata, event_type}); | ||||||
|     std::push_heap(event_queue.begin(), event_queue.end(), std::greater<Event>()); |     std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ScheduleEventThreadsafe(s64 cycles_into_future, const EventType* event_type, u64 userdata) { | void ScheduleEventThreadsafe(s64 cycles_into_future, const EventType* event_type, u64 userdata) { | ||||||
|  | @ -157,7 +157,7 @@ void UnscheduleEvent(const EventType* event_type, u64 userdata) { | ||||||
|     // Removing random items breaks the invariant so we have to re-establish it.
 |     // Removing random items breaks the invariant so we have to re-establish it.
 | ||||||
|     if (itr != event_queue.end()) { |     if (itr != event_queue.end()) { | ||||||
|         event_queue.erase(itr, event_queue.end()); |         event_queue.erase(itr, event_queue.end()); | ||||||
|         std::make_heap(event_queue.begin(), event_queue.end(), std::greater<Event>()); |         std::make_heap(event_queue.begin(), event_queue.end(), std::greater<>()); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -168,7 +168,7 @@ void RemoveEvent(const EventType* event_type) { | ||||||
|     // Removing random items breaks the invariant so we have to re-establish it.
 |     // Removing random items breaks the invariant so we have to re-establish it.
 | ||||||
|     if (itr != event_queue.end()) { |     if (itr != event_queue.end()) { | ||||||
|         event_queue.erase(itr, event_queue.end()); |         event_queue.erase(itr, event_queue.end()); | ||||||
|         std::make_heap(event_queue.begin(), event_queue.end(), std::greater<Event>()); |         std::make_heap(event_queue.begin(), event_queue.end(), std::greater<>()); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -189,7 +189,7 @@ void MoveEvents() { | ||||||
|     for (Event ev; ts_queue.Pop(ev);) { |     for (Event ev; ts_queue.Pop(ev);) { | ||||||
|         ev.fifo_order = event_fifo_id++; |         ev.fifo_order = event_fifo_id++; | ||||||
|         event_queue.emplace_back(std::move(ev)); |         event_queue.emplace_back(std::move(ev)); | ||||||
|         std::push_heap(event_queue.begin(), event_queue.end(), std::greater<Event>()); |         std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>()); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -204,7 +204,7 @@ void Advance() { | ||||||
| 
 | 
 | ||||||
|     while (!event_queue.empty() && event_queue.front().time <= global_timer) { |     while (!event_queue.empty() && event_queue.front().time <= global_timer) { | ||||||
|         Event evt = std::move(event_queue.front()); |         Event evt = std::move(event_queue.front()); | ||||||
|         std::pop_heap(event_queue.begin(), event_queue.end(), std::greater<Event>()); |         std::pop_heap(event_queue.begin(), event_queue.end(), std::greater<>()); | ||||||
|         event_queue.pop_back(); |         event_queue.pop_back(); | ||||||
|         evt.type->callback(evt.userdata, global_timer - evt.time); |         evt.type->callback(evt.userdata, global_timer - evt.time); | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue