summaryrefslogtreecommitdiffhomepage
path: root/src/mem.h
diff options
context:
space:
mode:
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