summaryrefslogtreecommitdiffstats
path: root/src/common.h
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2019-07-06 00:47:26 +0200
committereray orçunus <erayorcunus@gmail.com>2019-07-06 00:52:14 +0200
commit769c2812ffb317829dbef8b258ef3d2ebed7b484 (patch)
tree5c056bab681e962de1a7bb2ade0a120568cc06fa /src/common.h
parentCPed... (diff)
parentfinished CDamageManager (diff)
downloadre3-769c2812ffb317829dbef8b258ef3d2ebed7b484.tar
re3-769c2812ffb317829dbef8b258ef3d2ebed7b484.tar.gz
re3-769c2812ffb317829dbef8b258ef3d2ebed7b484.tar.bz2
re3-769c2812ffb317829dbef8b258ef3d2ebed7b484.tar.lz
re3-769c2812ffb317829dbef8b258ef3d2ebed7b484.tar.xz
re3-769c2812ffb317829dbef8b258ef3d2ebed7b484.tar.zst
re3-769c2812ffb317829dbef8b258ef3d2ebed7b484.zip
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index 3d260f6e..79626acb 100644
--- a/src/common.h
+++ b/src/common.h
@@ -49,6 +49,19 @@ typedef uint16_t wchar;
#define ALIGNPTR(p) (void*)((((uintptr)(void*)p) + sizeof(void*)-1) & ~(sizeof(void*)-1))
+// PDP-10 like byte functions
+#define MASK(p, s) (((1<<(s))-1) << (p))
+inline uint32 dpb(uint32 b, uint32 p, uint32 s, uint32 w)
+{
+ uint32 m = MASK(p,s);
+ return w & ~m | b<<p & m;
+}
+inline uint32 ldb(uint32 p, uint32 s, uint32 w)
+{
+ return w>>p & (1<<s)-1;
+}
+
+
// little hack
extern void **rwengine;
#define RwEngineInstance (*rwengine)