From 549a3f6ea5e13e39f006125c0f46b79645384604 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 22 Jun 2025 20:17:27 -0400 Subject: sys: param: Add PTR_NOFFSET define to sub pointers Signed-off-by: Ian Moffett --- sys/include/sys/param.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sys') diff --git a/sys/include/sys/param.h b/sys/include/sys/param.h index c0a5686..7331d5f 100644 --- a/sys/include/sys/param.h +++ b/sys/include/sys/param.h @@ -67,8 +67,12 @@ /* Gives 1 if pointer is aligned */ #define PTR_ALIGNED(PTR, ALIGN) (!((uintptr_t)PTR & (ALIGN - 1))) -/* Adds a value to a pointer */ +/* + * PTR_OFFSET: Adds an offset to the pointer + * PTR_NOFFSET: Subtracts a negative offset from the pointer + */ #define PTR_OFFSET(PTR, OFF) ((void *)((uintptr_t)PTR + OFF)) +#define PTR_NOFFSET(PTR, NOFF) ((void *)((uintptr_t)PTR - NOFF)) #define NELEM(a) (sizeof(a) / sizeof(a[0])) -- cgit v1.2.3