Without this, attempts to savestate std::set will fail with an error
about dropping the const qualifier.
<Lioncash> leoetlino: I'll try to break it down: So, when you do a
ranged-for on a container, it's essentially syntactic sugar over begin
and end iterators. std::set is an associative container where the key
type is the same as the value type, and so it's required that all
iterator functions return constant iterators. If this wasn't a
requirement, it would allow changing the ordering of elements from
outside of the set's API (this is bad).
Replace adhoc linked list with a priority heap. Performance
characteristics are mostly the same, but is more cache friendly.
[Priority Queues have O(log n) push/pop compared to the linked
list's O(n) push/O(1) pop but the queue is not big enough for
that to matter, so linear is faster over linked. Very slight gains
when framelimit is unlimited (Wind Waker), 1900% -> 1950%]
bool is not always guaranteed to be the same size on every platform.
On some platforms it may be one byte, on others it can be 8 bytes if the
platform dictates it. It's implementation-defined.
This can be problematic when it comes to storing this
data to disk (it can also be space-inefficient, but that's not really an
issue). Also say for some reason you moved your savestates to another
platform, it's possible they won't load correctly due to differences in size.
This change stores all bools to savestates as if they were a byte in size
and handles the loading of them accordingly.
Gets rid of magic numbers in cases where the array size is known at compile time.
This is also useful for future entries that are stack allocated arrays as these
functions prevent incorrect sizes being provided.
This is inconsistent with how other containers are used (i.e. with Do()), but making std::array be used with Do() seems rather confusing when there's also a DoArray available.
Decreases total Wii state save time (not counting compression) from
~570ms to ~18ms.
The compiler can't remove this check because of potential aliasing; this
might be fixable (e.g. by making mode const), but there is no reason to
have the code work in such a braindead way in the first place.
- DoVoid now uses memcpy.
- DoArray now uses DoVoid on the whole rather than Doing each element
(would fail for an array of STL structures, but we don't have any of
those).
- Do also now uses DoVoid. (In the previous version, it replicated
DoVoid's code in order to ensure each type gets its own implementation,
which for small types then becomes a simple load/store in any modern
compiler. Now DoVoid is __forceinline, which addresses that issue and
shouldn't make a big difference otherwise - perhaps a few extra copies
of the code inlined into DoArray or whatever.)
This shouldn't really be exposed as a public function and should only be called through other Do class functions that take a container type as a parameter.
Between C++11 and C++14, volatile types stopped being trivially
copyable. The serializer has no reason to care about this distinction,
so tack on remove_volatile.