[Base] Add user-literals for several memory sizes
Rather than using `n * 1024 * 1024`, this adds a convenient `_MiB`/`_KiB` user-literal to the new `literals.h` header to concisely describe units of memory in a much more readable way. Any other useful literals can be added to this header. These literals exist in the `xe::literals` namespace so they are opt-in, similar to `std::chrono` literals, and require a `using namespace xe::literals` statement to utilize it within the current scope. I've done a pass through the codebase to replace trivial instances of `1024 * 1024 * ...` expressions being used but avoided anything that added additional casting complexity from `size_t` to `uint32_t` and such to keep this commit concise.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "xenia/base/console_app_main.h"
|
||||
#include "xenia/base/cvar.h"
|
||||
#include "xenia/base/filesystem.h"
|
||||
#include "xenia/base/literals.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/platform.h"
|
||||
@@ -36,6 +37,7 @@ namespace cpu {
|
||||
namespace test {
|
||||
|
||||
using xe::cpu::ppc::PPCContext;
|
||||
using namespace xe::literals;
|
||||
|
||||
typedef std::vector<std::pair<std::string, std::string>> AnnotationList;
|
||||
|
||||
@@ -177,7 +179,7 @@ class TestSuite {
|
||||
|
||||
class TestRunner {
|
||||
public:
|
||||
TestRunner() : memory_size_(64 * 1024 * 1024) {
|
||||
TestRunner() : memory_size_(64_MiB) {
|
||||
memory_.reset(new Memory());
|
||||
memory_->Initialize();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user