diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2023-11-16 16:03:19 -0500 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2023-11-16 16:03:19 -0500 |
commit | 9ac70bfc0ee49e70005ec7d15fa5003b05fd06df (patch) | |
tree | 46bd2a6e69e107bfa0b0b97e9c69aa361335230c | |
parent | ebbde43fa98315a57a15650944f80757f9652b9b (diff) |
add dict impl to libalee section
-rw-r--r-- | splitmemdict.hpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/splitmemdict.hpp b/splitmemdict.hpp index 1093fbc..49c0408 100644 --- a/splitmemdict.hpp +++ b/splitmemdict.hpp @@ -35,6 +35,7 @@ class SplitMemDict : public Dictionary uint8_t rwdict[MemDictSize - Dictionary::Begin] = {0}; uint8_t extra[Dictionary::Begin]; + LIBALEE_SECTION Addr convertAddress(Addr addr) const noexcept { return addr < RON ? addr : static_cast<Addr>(addr - RON); } @@ -53,6 +54,7 @@ public: return *this; } + LIBALEE_SECTION virtual Cell read(Addr addr) const noexcept final { const uint8_t *dict; if (addr < RON) @@ -63,6 +65,7 @@ public: return *reinterpret_cast<const Cell *>(dict + convertAddress(addr)); } + LIBALEE_SECTION virtual void write(Addr addr, Cell value) noexcept final { if (addr >= RON) *reinterpret_cast<Cell *>(rwdict + addr - RON) = value; @@ -70,6 +73,7 @@ public: *reinterpret_cast<Cell *>(extra + addr) = value; } + LIBALEE_SECTION virtual uint8_t readbyte(Addr addr) const noexcept final { const uint8_t *dict; if (addr < RON) @@ -80,6 +84,7 @@ public: return dict[convertAddress(addr)]; } + LIBALEE_SECTION virtual void writebyte(Addr addr, uint8_t value) noexcept final { if (addr >= RON) rwdict[addr - RON] = value; @@ -87,6 +92,7 @@ public: extra[addr] = value; } + LIBALEE_SECTION virtual unsigned long int capacity() const noexcept final { return RON + sizeof(extra) + sizeof(rwdict); } |