1
2
3
4
5#ifndef _M68K_BITOPS_H
6#define _M68K_BITOPS_H
7
8#include <linux/config.h>
9#include <asm/byteorder.h>
10
11extern void set_bit(int nr, volatile void *addr);
12extern void clear_bit(int nr, volatile void *addr);
13extern void change_bit(int nr, volatile void *addr);
14extern int test_and_set_bit(int nr, volatile void *addr);
15extern int test_and_clear_bit(int nr, volatile void *addr);
16extern int test_and_change_bit(int nr, volatile void *addr);
17
18#ifdef __KERNEL__
19
20
21
22
23
24
25extern __inline__ int ffs(int x)
26{
27 int r = 1;
28
29 if (!x)
30 return 0;
31 if (!(x & 0xffff)) {
32 x >>= 16;
33 r += 16;
34 }
35 if (!(x & 0xff)) {
36 x >>= 8;
37 r += 8;
38 }
39 if (!(x & 0xf)) {
40 x >>= 4;
41 r += 4;
42 }
43 if (!(x & 3)) {
44 x >>= 2;
45 r += 2;
46 }
47 if (!(x & 1)) {
48 x >>= 1;
49 r += 1;
50 }
51 return r;
52}
53#define __ffs(x) (ffs(x) - 1)
54#define PLATFORM_FFS
55
56#endif
57
58#endif
59