summaryrefslogtreecommitdiffhomepage
path: root/src/mem.h
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2022-05-16 21:07:41 +0100
committerMichael Smith <mikesmiffy128@gmail.com>2022-05-16 22:15:46 +0100
commit278b61bc3f2018515e26fd6b45410aded8b6417e (patch)
tree39a860b66c3d88e91359f48dbf937c0c71d61833 /src/mem.h
parente8843dba3eb1c7a67f6ff7b920046ae36a12acd0 (diff)
Clean up some random bits and bobs
Diffstat (limited to 'src/mem.h')
-rw-r--r--src/mem.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mem.h b/src/mem.h
index 3e48a24..077b74d 100644
--- a/src/mem.h
+++ b/src/mem.h
@@ -68,6 +68,11 @@ static inline void mem_storeptr(void *to, const void *val) {
* to any pointer type */
static inline void *mem_offset(void *p, int off) { return (char *)p + off; }
+/* returns the offset in bytes from one pointer to another (p - q) */
+static inline ssize mem_diff(const void *p, const void *q) {
+ return (char *)p - (char *)q;
+}
+
#endif
// vi: sw=4 ts=4 noet tw=80 cc=80