From 4b7780f5c62f1b1ce98c8a4d7320a8a9dfc7c580 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 20 Aug 2015 17:15:51 -0700 Subject: [PATCH] Move _KiB and _MiB user-defined literals to utility.hpp. Where I put all the stuff I don't know where to put. --- firmware/common/memory_map.hpp | 10 ++-------- firmware/common/utility.hpp | 8 ++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/firmware/common/memory_map.hpp b/firmware/common/memory_map.hpp index 3a1155bd..6f4eae1e 100644 --- a/firmware/common/memory_map.hpp +++ b/firmware/common/memory_map.hpp @@ -28,6 +28,8 @@ #include "lpc43xx_cpp.hpp" using namespace lpc43xx; +#include "utility.hpp" + namespace portapack { namespace memory { @@ -58,14 +60,6 @@ private: const size_t size_; }; -constexpr size_t operator "" _KiB(unsigned long long v) { - return v * 1024; -} - -constexpr size_t operator "" _MiB(unsigned long long v) { - return v * 1024 * 1024; -} - namespace map { constexpr region_t local_sram_0 { 0x10000000, 96_KiB }; diff --git a/firmware/common/utility.hpp b/firmware/common/utility.hpp index 1407f687..be341042 100644 --- a/firmware/common/utility.hpp +++ b/firmware/common/utility.hpp @@ -32,6 +32,14 @@ #define LOCATE_IN_RAM __attribute__((section(".ramtext"))) +constexpr size_t operator "" _KiB(unsigned long long v) { + return v * 1024; +} + +constexpr size_t operator "" _MiB(unsigned long long v) { + return v * 1024 * 1024; +} + template constexpr typename std::underlying_type::type toUType(E enumerator) noexcept { /* Thanks, Scott Meyers! */