xref: /third_party/ltp/include/tst_bitmap.h (revision f08c3bdf)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (c) Linux Test Project, 2021
4 * Author: Xie Ziyao <ziyaoxie@outlook.com>
5 */
6
7#ifndef TST_BITMAP_H__
8#define TST_BITMAP_H__
9
10/*
11 * Check whether the n-th bit of val is set
12 * @return 0: the n-th bit of val is 0, 1: the n-th bit of val is 1
13 */
14#define TST_IS_BIT_SET(val, n) (((val) & (1<<(n))) >> (n))
15
16#endif /* TST_BITMAP_H__ */
17