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