diff options
author | Michael Smith <mikesmiffy128@gmail.com> | 2022-05-16 21:07:41 +0100 |
---|---|---|
committer | Michael Smith <mikesmiffy128@gmail.com> | 2022-05-16 22:15:46 +0100 |
commit | 278b61bc3f2018515e26fd6b45410aded8b6417e (patch) | |
tree | 39a860b66c3d88e91359f48dbf937c0c71d61833 /src/mem.h | |
parent | e8843dba3eb1c7a67f6ff7b920046ae36a12acd0 (diff) |
Clean up some random bits and bobs
Diffstat (limited to 'src/mem.h')
-rw-r--r-- | src/mem.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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 |