]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - tools/include/asm-generic/bitops/atomic.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_
3 #define _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_
6 #include <asm/bitsperlong.h>
8 static inline void set_bit(int nr
, unsigned long *addr
)
10 addr
[nr
/ __BITS_PER_LONG
] |= 1UL << (nr
% __BITS_PER_LONG
);
13 static inline void clear_bit(int nr
, unsigned long *addr
)
15 addr
[nr
/ __BITS_PER_LONG
] &= ~(1UL << (nr
% __BITS_PER_LONG
));
18 static __always_inline
int test_bit(unsigned int nr
, const unsigned long *addr
)
20 return ((1UL << (nr
% __BITS_PER_LONG
)) &
21 (((unsigned long *)addr
)[nr
/ __BITS_PER_LONG
])) != 0;
24 #define __set_bit(nr, addr) set_bit(nr, addr)
25 #define __clear_bit(nr, addr) clear_bit(nr, addr)
27 #endif /* _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_ */