mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-24 23:09:26 -05:00
Move _KiB and _MiB user-defined literals to utility.hpp.
Where I put all the stuff I don't know where to put.
This commit is contained in:
parent
1c3e45917c
commit
4b7780f5c6
@ -28,6 +28,8 @@
|
|||||||
#include "lpc43xx_cpp.hpp"
|
#include "lpc43xx_cpp.hpp"
|
||||||
using namespace lpc43xx;
|
using namespace lpc43xx;
|
||||||
|
|
||||||
|
#include "utility.hpp"
|
||||||
|
|
||||||
namespace portapack {
|
namespace portapack {
|
||||||
namespace memory {
|
namespace memory {
|
||||||
|
|
||||||
@ -58,14 +60,6 @@ private:
|
|||||||
const size_t size_;
|
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 {
|
namespace map {
|
||||||
|
|
||||||
constexpr region_t local_sram_0 { 0x10000000, 96_KiB };
|
constexpr region_t local_sram_0 { 0x10000000, 96_KiB };
|
||||||
|
@ -32,6 +32,14 @@
|
|||||||
|
|
||||||
#define LOCATE_IN_RAM __attribute__((section(".ramtext")))
|
#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<typename E>
|
template<typename E>
|
||||||
constexpr typename std::underlying_type<E>::type toUType(E enumerator) noexcept {
|
constexpr typename std::underlying_type<E>::type toUType(E enumerator) noexcept {
|
||||||
/* Thanks, Scott Meyers! */
|
/* Thanks, Scott Meyers! */
|
||||||
|
Loading…
Reference in New Issue
Block a user