mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Added CPU, mutex, process, thread, timer
This commit is contained in:
		
							parent
							
								
									06891d9454
								
							
						
					
					
						commit
						f557d26b40
					
				
					 20 changed files with 299 additions and 41 deletions
				
			
		|  | @ -91,6 +91,7 @@ add_library(common STATIC | |||
|     scm_rev.h | ||||
|     scope_exit.h | ||||
|     serialization/atomic.h | ||||
|     serialization/boost_flat_set.h | ||||
|     serialization/boost_vector.hpp | ||||
|     string_util.cpp | ||||
|     string_util.h | ||||
|  |  | |||
							
								
								
									
										37
									
								
								src/common/serialization/boost_flat_set.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								src/common/serialization/boost_flat_set.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,37 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include "common/common_types.h" | ||||
| #include <boost/container/flat_set.hpp> | ||||
| #include <boost/serialization/split_free.hpp> | ||||
| 
 | ||||
| namespace boost::serialization { | ||||
| 
 | ||||
| template <class Archive, class T> | ||||
| void save(Archive& ar, const boost::container::flat_set<T>& set, const unsigned int file_version) | ||||
| { | ||||
|     ar << static_cast<u64>(set.size()); | ||||
|     for (auto &v : set) { | ||||
|         ar << v; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| template <class Archive, class T> | ||||
| void load(Archive& ar, boost::container::flat_set<T>& set, const unsigned int file_version) | ||||
| { | ||||
|     u64 count{}; | ||||
|     ar >> count; | ||||
|     set.clear(); | ||||
|     for (auto i = 0; i < count; i++) { | ||||
|         T value{}; | ||||
|         ar >> value; | ||||
|         set.insert(value); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| template <class Archive, class T> | ||||
| void serialize(Archive& ar, boost::container::flat_set<T>& set, const unsigned int file_version) | ||||
| { | ||||
|     boost::serialization::split_free(ar, set, file_version); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  | @ -6,6 +6,9 @@ | |||
| 
 | ||||
| #include <array> | ||||
| #include <deque> | ||||
| #include <boost/serialization/deque.hpp> | ||||
| #include <boost/serialization/split_member.hpp> | ||||
| #include "common/common_types.h" | ||||
| 
 | ||||
| namespace Common { | ||||
| 
 | ||||
|  | @ -156,6 +159,34 @@ private: | |||
|     Queue* first; | ||||
|     // The priority level queues of thread ids.
 | ||||
|     std::array<Queue, NUM_QUEUES> queues; | ||||
| 
 | ||||
|     friend class boost::serialization::access; | ||||
|     template <class Archive> | ||||
|     void save(Archive& ar, const unsigned int file_version) const | ||||
|     { | ||||
|         s32 idx = first == UnlinkedTag() ? -1 : static_cast<s32>(first - &queues[0]); | ||||
|         ar << idx; | ||||
|         for (auto i = 0; i < NUM_QUEUES; i++) { | ||||
|             s32 idx1 = first == UnlinkedTag() ? -1 : static_cast<s32>(queues[i].next_nonempty - &queues[0]); | ||||
|             ar << idx1; | ||||
|             ar << queues[i].data; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     template <class Archive> | ||||
|     void load(Archive& ar, const unsigned int file_version) | ||||
|     { | ||||
|         s32 idx; | ||||
|         ar >> idx; | ||||
|         first = idx < 0 ? UnlinkedTag() : &queues[idx]; | ||||
|         for (auto i = 0; i < NUM_QUEUES; i++) { | ||||
|             ar >> idx; | ||||
|             queues[i].next_nonempty = idx < 0 ? UnlinkedTag() : &queues[idx]; | ||||
|             ar >> queues[i].data; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     BOOST_SERIALIZATION_SPLIT_MEMBER() | ||||
| }; | ||||
| 
 | ||||
| } // namespace Common
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue