18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * bitops.h: Bit string operations on the V9.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef _SPARC64_BITOPS_H
98c2ecf20Sopenharmony_ci#define _SPARC64_BITOPS_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef _LINUX_BITOPS_H
128c2ecf20Sopenharmony_ci#error only <linux/bitops.h> can be included directly
138c2ecf20Sopenharmony_ci#endif
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include <linux/compiler.h>
168c2ecf20Sopenharmony_ci#include <asm/byteorder.h>
178c2ecf20Sopenharmony_ci#include <asm/barrier.h>
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciint test_and_set_bit(unsigned long nr, volatile unsigned long *addr);
208c2ecf20Sopenharmony_ciint test_and_clear_bit(unsigned long nr, volatile unsigned long *addr);
218c2ecf20Sopenharmony_ciint test_and_change_bit(unsigned long nr, volatile unsigned long *addr);
228c2ecf20Sopenharmony_civoid set_bit(unsigned long nr, volatile unsigned long *addr);
238c2ecf20Sopenharmony_civoid clear_bit(unsigned long nr, volatile unsigned long *addr);
248c2ecf20Sopenharmony_civoid change_bit(unsigned long nr, volatile unsigned long *addr);
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciint fls(unsigned int word);
278c2ecf20Sopenharmony_ciint __fls(unsigned long word);
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#include <asm-generic/bitops/non-atomic.h>
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#include <asm-generic/bitops/fls64.h>
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#ifdef __KERNEL__
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciint ffs(int x);
368c2ecf20Sopenharmony_ciunsigned long __ffs(unsigned long);
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#include <asm-generic/bitops/ffz.h>
398c2ecf20Sopenharmony_ci#include <asm-generic/bitops/sched.h>
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/*
428c2ecf20Sopenharmony_ci * hweightN: returns the hamming weight (i.e. the number
438c2ecf20Sopenharmony_ci * of bits set) of a N-bit word
448c2ecf20Sopenharmony_ci */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciunsigned long __arch_hweight64(__u64 w);
478c2ecf20Sopenharmony_ciunsigned int __arch_hweight32(unsigned int w);
488c2ecf20Sopenharmony_ciunsigned int __arch_hweight16(unsigned int w);
498c2ecf20Sopenharmony_ciunsigned int __arch_hweight8(unsigned int w);
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#include <asm-generic/bitops/const_hweight.h>
528c2ecf20Sopenharmony_ci#include <asm-generic/bitops/lock.h>
538c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#include <asm-generic/bitops/find.h>
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#ifdef __KERNEL__
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#include <asm-generic/bitops/le.h>
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#include <asm-generic/bitops/ext2-atomic-setbit.h>
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#endif /* defined(_SPARC64_BITOPS_H) */
66