Linux Audio

Check our new training course

Loading...
v4.17
 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_
 4
 5#include <asm/types.h>
 6#include <asm/bitsperlong.h>
 7
 8static inline void set_bit(int nr, unsigned long *addr)
 9{
10	addr[nr / __BITS_PER_LONG] |= 1UL << (nr % __BITS_PER_LONG);
11}
12
13static inline void clear_bit(int nr, unsigned long *addr)
14{
15	addr[nr / __BITS_PER_LONG] &= ~(1UL << (nr % __BITS_PER_LONG));
16}
17
18static __always_inline int test_bit(unsigned int nr, const unsigned long *addr)
19{
20	return ((1UL << (nr % __BITS_PER_LONG)) &
21		(((unsigned long *)addr)[nr / __BITS_PER_LONG])) != 0;
22}
23
24#define __set_bit(nr, addr)	set_bit(nr, addr)
25#define __clear_bit(nr, addr)	clear_bit(nr, addr)
26
27#endif /* _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_ */
v6.13.7
 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_
 4
 5#include <asm/types.h>
 6#include <asm/bitsperlong.h>
 7
 8/*
 9 * Just alias the test versions, all of the compiler built-in atomics "fetch",
10 * and optimizing compile-time constants on x86 isn't worth the complexity.
11 */
12#define set_bit test_and_set_bit
13#define clear_bit test_and_clear_bit
 
 
 
 
 
 
 
 
 
 
 
 
14
15#endif /* _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_ */