Date: Thu, 22 Apr 2021 23:39:02 -0600 From: "Jason A. Donenfeld" <Jason@zx2c4.com> To: freebsd-net@freebsd.org Cc: "Jason A. Donenfeld" <Jason@zx2c4.com> Subject: [PATCH 2/2] ck: add pr_{load,store}_bool functions Message-ID: <20210423053902.16087-3-Jason@zx2c4.com> In-Reply-To: <20210423053902.16087-1-Jason@zx2c4.com> References: <20210423053902.16087-1-Jason@zx2c4.com>
next in thread | previous in thread | raw e-mail | index | archive | help
While these are functionally the same as ck_pr_{load,store}_8, it's actually quite useful to be able to use this on ordinary bool types, without having to add casting to every callsite. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> --- sys/contrib/ck/include/ck_pr.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/contrib/ck/include/ck_pr.h b/sys/contrib/ck/include/ck_pr.h index 2de6e13ec3c..61616213999 100644 --- a/sys/contrib/ck/include/ck_pr.h +++ b/sys/contrib/ck/include/ck_pr.h @@ -179,6 +179,7 @@ ck_pr_rfo(const void *m) #define ck_pr_store_32(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), 32) #define ck_pr_store_16(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), 16) #define ck_pr_store_8(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), 8) +#define ck_pr_store_bool(DST, VAL) ck_pr_store_8((uint8_t *)(DST), (uint8_t)(VAL)) #define ck_pr_store_ptr_unsafe(DST, VAL) ck_pr_md_store_ptr((DST), (VAL)) @@ -199,6 +200,7 @@ ck_pr_rfo(const void *m) #define ck_pr_load_32(SRC) CK_PR_LOAD_SAFE((SRC), 32) #define ck_pr_load_16(SRC) CK_PR_LOAD_SAFE((SRC), 16) #define ck_pr_load_8(SRC) CK_PR_LOAD_SAFE((SRC), 8) +#define ck_pr_load_bool(SRC) ((bool)ck_pr_load_8((uint8_t *)(SRC))) #ifdef CK_F_PR_LOAD_64 #define ck_pr_load_64(SRC) CK_PR_LOAD_SAFE((SRC), 64) -- 2.31.1
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210423053902.16087-3-Jason>