[PATCH 2/2] ck: add pr_{load,store}_bool functions
Jason A. Donenfeld
Jason at zx2c4.com
Fri Apr 23 05:39:13 UTC 2021
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 at 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
More information about the freebsd-net
mailing list