summaryrefslogtreecommitdiff
path: root/inc/storage.h
diff options
context:
space:
mode:
Diffstat (limited to 'inc/storage.h')
-rw-r--r--inc/storage.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/inc/storage.h b/inc/storage.h
index 1bf5805..994bb8f 100644
--- a/inc/storage.h
+++ b/inc/storage.h
@@ -7,6 +7,15 @@
#include <map>
#include <vector>
+// clang-format off
+/**
+ * Ensures address is within the current memory size using a clean wrap.
+ * @param an address
+ */
+#define WRAP_ADDRESS(a) \
+ ((a < 0) ? ((a % MEM_WORDS) + MEM_WORDS) % MEM_WORDS : a % MEM_WORDS)
+// clang-format on
+
class Storage
{
public: