bitops_64.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * bitops.h: Bit string operations on the V9.
  3. *
  4. * Copyright 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
  5. */
  6. #ifndef _SPARC64_BITOPS_H
  7. #define _SPARC64_BITOPS_H
  8. #ifndef _LINUX_BITOPS_H
  9. #error only <linux/bitops.h> can be included directly
  10. #endif
  11. #include <linux/compiler.h>
  12. #include <asm/byteorder.h>
  13. extern int test_and_set_bit(unsigned long nr, volatile unsigned long *addr);
  14. extern int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr);
  15. extern int test_and_change_bit(unsigned long nr, volatile unsigned long *addr);
  16. extern void set_bit(unsigned long nr, volatile unsigned long *addr);
  17. extern void clear_bit(unsigned long nr, volatile unsigned long *addr);
  18. extern void change_bit(unsigned long nr, volatile unsigned long *addr);
  19. #include <asm-generic/bitops/non-atomic.h>
  20. #define smp_mb__before_clear_bit() barrier()
  21. #define smp_mb__after_clear_bit() barrier()
  22. #include <asm-generic/bitops/fls.h>
  23. #include <asm-generic/bitops/__fls.h>
  24. #include <asm-generic/bitops/fls64.h>
  25. #ifdef __KERNEL__
  26. extern int ffs(int x);
  27. extern 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. extern unsigned long __arch_hweight64(__u64 w);
  35. extern unsigned int __arch_hweight32(unsigned int w);
  36. extern unsigned int __arch_hweight16(unsigned int w);
  37. extern 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. #include <asm-generic/bitops/find.h>
  42. #ifdef __KERNEL__
  43. #include <asm-generic/bitops/le.h>
  44. #include <asm-generic/bitops/ext2-atomic-setbit.h>
  45. #endif /* __KERNEL__ */
  46. #endif /* defined(_SPARC64_BITOPS_H) */