Rev 1964 | Rev 3031 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1964 | Rev 1970 | ||
---|---|---|---|
Line 107... | Line 107... | ||
107 | static inline __u8 ror8(__u8 word, unsigned int shift) |
107 | static inline __u8 ror8(__u8 word, unsigned int shift) |
108 | { |
108 | { |
109 | return (word >> shift) | (word << (8 - shift)); |
109 | return (word >> shift) | (word << (8 - shift)); |
110 | } |
110 | } |
Line -... | Line 111... | ||
- | 111 | ||
- | 112 | /** |
|
- | 113 | * sign_extend32 - sign extend a 32-bit value using specified bit as sign-bit |
|
- | 114 | * @value: value to sign extend |
|
- | 115 | * @index: 0 based bit index (0<=index<32) to sign bit |
|
- | 116 | */ |
|
- | 117 | static inline __s32 sign_extend32(__u32 value, int index) |
|
- | 118 | { |
|
- | 119 | __u8 shift = 31 - index; |
|
- | 120 | return (__s32)(value << shift) >> shift; |
|
- | 121 | } |
|
111 | 122 | ||
112 | static inline unsigned fls_long(unsigned long l) |
123 | static inline unsigned fls_long(unsigned long l) |
113 | { |
124 | { |
114 | if (sizeof(l) == 4) |
125 | if (sizeof(l) == 4) |
115 | return fls(l); |
126 | return fls(l); |
Line 135... | Line 146... | ||
135 | return __ffs((unsigned long)word); |
146 | return __ffs((unsigned long)word); |
136 | } |
147 | } |
Line 137... | Line 148... | ||
137 | 148 | ||
Line 138... | Line 149... | ||
138 | #ifdef __KERNEL__ |
149 | #ifdef __KERNEL__ |
139 | 150 | ||
140 | #ifdef CONFIG_GENERIC_FIND_LAST_BIT |
151 | #ifndef find_last_bit |
141 | /** |
152 | /** |
142 | * find_last_bit - find the last set bit in a memory region |
153 | * find_last_bit - find the last set bit in a memory region |
143 | * @addr: The address to start the search at |
154 | * @addr: The address to start the search at |
144 | * @size: The maximum size to search |
155 | * @size: The maximum size to search |
145 | * |
156 | * |
146 | * Returns the bit number of the first set bit, or size. |
157 | * Returns the bit number of the first set bit, or size. |
147 | */ |
158 | */ |
148 | extern unsigned long find_last_bit(const unsigned long *addr, |
159 | extern unsigned long find_last_bit(const unsigned long *addr, |
Line 149... | Line 160... | ||
149 | unsigned long size); |
160 | unsigned long size); |
150 | #endif /* CONFIG_GENERIC_FIND_LAST_BIT */ |
161 | #endif |