bitops_64.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * bitops.h: Bit string operations on the V9.
  4. *
  5. * Copyright 1996, 1997 David S. Miller ([email protected])
  6. */
  7. #ifndef _SPARC64_BITOPS_H
  8. #define _SPARC64_BITOPS_H
  9. #ifndef _LINUX_BITOPS_H
  10. #error only <linux/bitops.h> can be included directly
  11. #endif
  12. #include <linux/compiler.h>
  13. #include <asm/byteorder.h>
  14. #include <asm/barrier.h>
  15. int test_and_set_bit(unsigned long nr, volatile unsigned long *addr);
  16. int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr);
  17. int test_and_change_bit(unsigned long nr, volatile unsigned long *addr);
  18. void set_bit(unsigned long nr, volatile unsigned long *addr);
  19. void clear_bit(unsigned long nr, volatile unsigned long *addr);
  20. void change_bit(unsigned long nr, volatile unsigned long *addr);
  21. int fls(unsigned int word);
  22. int __fls(unsigned long word);
  23. #include <asm-generic/bitops/non-atomic.h>
  24. #include <asm-generic/bitops/fls64.h>
  25. #ifdef __KERNEL__
  26. int ffs(int x);
  27. unsigned long __ffs(unsigned long);
  28. #include <asm-generic/bitops/ffz.h>
  29. #include <asm-generic/bitops/sched.h>
  30. /*
  31. * hweightN: returns the hamming weight (i.e. the number
  32. * of bits set) of a N-bit word
  33. */
  34. unsigned long __arch_hweight64(__u64 w);
  35. unsigned int __arch_hweight32(unsigned int w);
  36. unsigned int __arch_hweight16(unsigned int w);
  37. unsigned int __arch_hweight8(unsigned int w);
  38. #include <asm-generic/bitops/const_hweight.h>
  39. #include <asm-generic/bitops/lock.h>
  40. #endif /* __KERNEL__ */
  41. #ifdef __KERNEL__
  42. #include <asm-generic/bitops/le.h>
  43. #include <asm-generic/bitops/ext2-atomic-setbit.h>
  44. #endif /* __KERNEL__ */
  45. #endif /* defined(_SPARC64_BITOPS_H) */