162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * bitops.h: Bit string operations on the V9. 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright 1996, 1997 David S. Miller (davem@caip.rutgers.edu) 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#ifndef _SPARC64_BITOPS_H 962306a36Sopenharmony_ci#define _SPARC64_BITOPS_H 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#ifndef _LINUX_BITOPS_H 1262306a36Sopenharmony_ci#error only <linux/bitops.h> can be included directly 1362306a36Sopenharmony_ci#endif 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#include <linux/compiler.h> 1662306a36Sopenharmony_ci#include <asm/byteorder.h> 1762306a36Sopenharmony_ci#include <asm/barrier.h> 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ciint test_and_set_bit(unsigned long nr, volatile unsigned long *addr); 2062306a36Sopenharmony_ciint test_and_clear_bit(unsigned long nr, volatile unsigned long *addr); 2162306a36Sopenharmony_ciint test_and_change_bit(unsigned long nr, volatile unsigned long *addr); 2262306a36Sopenharmony_civoid set_bit(unsigned long nr, volatile unsigned long *addr); 2362306a36Sopenharmony_civoid clear_bit(unsigned long nr, volatile unsigned long *addr); 2462306a36Sopenharmony_civoid change_bit(unsigned long nr, volatile unsigned long *addr); 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ciint fls(unsigned int word); 2762306a36Sopenharmony_ciint __fls(unsigned long word); 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci#include <asm-generic/bitops/non-atomic.h> 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci#include <asm-generic/bitops/fls64.h> 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci#ifdef __KERNEL__ 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ciint ffs(int x); 3662306a36Sopenharmony_ciunsigned long __ffs(unsigned long); 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci#include <asm-generic/bitops/ffz.h> 3962306a36Sopenharmony_ci#include <asm-generic/bitops/sched.h> 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci/* 4262306a36Sopenharmony_ci * hweightN: returns the hamming weight (i.e. the number 4362306a36Sopenharmony_ci * of bits set) of a N-bit word 4462306a36Sopenharmony_ci */ 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ciunsigned long __arch_hweight64(__u64 w); 4762306a36Sopenharmony_ciunsigned int __arch_hweight32(unsigned int w); 4862306a36Sopenharmony_ciunsigned int __arch_hweight16(unsigned int w); 4962306a36Sopenharmony_ciunsigned int __arch_hweight8(unsigned int w); 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci#include <asm-generic/bitops/const_hweight.h> 5262306a36Sopenharmony_ci#include <asm-generic/bitops/lock.h> 5362306a36Sopenharmony_ci#endif /* __KERNEL__ */ 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci#ifdef __KERNEL__ 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci#include <asm-generic/bitops/le.h> 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci#include <asm-generic/bitops/ext2-atomic-setbit.h> 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci#endif /* __KERNEL__ */ 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci#endif /* defined(_SPARC64_BITOPS_H) */ 64