From: Xie Ziyao <ziyaoxie@outlook.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/4 v2] api: Add a IS_BIT_SET() macro in tst_bitmap.h
Date: Wed, 25 Aug 2021 15:39:29 +0000 [thread overview]
Message-ID: <OSZP286MB0871E8F61CE0773AF89CF35FCCC69@OSZP286MB0871.JPNP286.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20210825153932.138396-1-ziyaoxie@outlook.com>
From: "Xie Ziyao" <ziyaoxie@outlook.com>
Add a IS_BIT_SET() macro in tst_bitmap.h to check whether the n-th bit
of val is set.
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Xie Ziyao <ziyaoxie@outlook.com>
---
v1->v2:
1. Add a IS_BIT_SET() macro in tst_bitmap.h.
include/tst_bitmap.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 include/tst_bitmap.h
diff --git a/include/tst_bitmap.h b/include/tst_bitmap.h
new file mode 100644
index 000000000..528a2bdaa
--- /dev/null
+++ b/include/tst_bitmap.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright (c) Linux Test Project, 2021
+ * Author: Xie Ziyao <ziyaoxie@outlook.com>
+ */
+
+#ifndef TST_BITMAP_H__
+#define TST_BITMAP_H__
+
+/*
+ * Check whether the n-th bit of val is set
+ * @return 0: the n-th bit of val is 0, 1: the n-th bit of val is 1
+ */
+#define IS_BIT_SET(val, n) (((val) & (1<<(n))) >> (n))
+
+#endif /* TST_BITMAP_H__ */
--
2.25.1
next parent reply other threads:[~2021-08-25 15:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210825153932.138396-1-ziyaoxie@outlook.com>
2021-08-25 15:39 ` Xie Ziyao [this message]
2021-08-26 15:29 ` [LTP] [PATCH 1/4 v2] api: Add a IS_BIT_SET() macro in tst_bitmap.h Cyril Hrubis
2021-08-25 15:39 ` [LTP] [PATCH 2/4 v2] epoll_ctl: Add test for epoll_ctl03 Xie Ziyao
2021-08-26 15:29 ` Cyril Hrubis
2021-08-25 15:39 ` [LTP] [PATCH 3/4 v2] epoll_create: Add test for epoll_create01 Xie Ziyao
2021-08-25 15:39 ` [LTP] [PATCH 4/4 v2] epoll_create: Add test for epoll_create02 Xie Ziyao
2021-08-26 15:35 ` Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=OSZP286MB0871E8F61CE0773AF89CF35FCCC69@OSZP286MB0871.JPNP286.PROD.OUTLOOK.COM \
--to=ziyaoxie@outlook.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox