aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/base.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/base.h b/lib/base.h
index dbeec80..f21e4a8 100644
--- a/lib/base.h
+++ b/lib/base.h
@@ -49,9 +49,10 @@ typedef enum
DATA_TYPE_WORD,
} data_type_t;
-#define DBYTE(BYTE) ((data_t){.as_byte = (BYTE)})
-#define DHWORD(HWORD) ((data_t){.as_hword = (HWORD)})
-#define DWORD(WORD) ((data_t){.as_word = (WORD)})
+#define DBYTE(BYTE) ((data_t){.as_byte = (BYTE)})
+#define DHWORD(HWORD) ((data_t){.as_hword = (HWORD)})
+#define DWORD(WORD) ((data_t){.as_word = (WORD)})
+#define WORD_SAFE_SUB(W, SUB) ((W) > (SUB) ? ((W) - (SUB)) : 0)
#define HWORD_SIZE sizeof(hword)
#define WORD_SIZE sizeof(word)