diff tools/lib64gfx.c @ 1645:262300a0359b

Add helper functions dmReverse{Get,Put}Byte().
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 30 May 2018 00:57:21 +0300
parents 9d9a0e852b3d
children 948d6fda722d
line wrap: on
line diff
--- a/tools/lib64gfx.c	Wed May 30 00:56:32 2018 +0300
+++ b/tools/lib64gfx.c	Wed May 30 00:57:21 2018 +0300
@@ -100,6 +100,30 @@
 }
 
 
+BOOL dmReverseGetByte(const Uint8 *buf, size_t *offs, Uint8 *data)
+{
+    if (*offs > 0)
+    {
+        *data = buf[--(*offs)];
+        return TRUE;
+    }
+    else
+        return FALSE;
+}
+
+
+BOOL dmReversePutByte(Uint8 *buf, size_t *offs, const Uint8 data)
+{
+    if (*offs > 0)
+    {
+        buf[--(*offs)] = data;
+        return TRUE;
+    }
+    else
+        return FALSE;
+}
+
+
 int dmC64MemBlockAlloc(DMC64MemBlock *blk, const size_t size)
 {
     if ((blk->data = dmMalloc0(size)) == NULL)