1 #ifndef _ASM_WORD_AT_A_TIME_H
2 #define _ASM_WORD_AT_A_TIME_H
5 * Word-at-a-time interfaces for PowerPC.
8 #include <linux/kernel.h>
9 #include <asm/asm-compat.h>
11 struct word_at_a_time
{
12 const unsigned long high_bits
, low_bits
;
15 #define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE(0xfe) + 1, REPEAT_BYTE(0x7f) }
17 /* Bit set in the bytes that have a zero */
18 static inline long prep_zero_mask(unsigned long val
, unsigned long rhs
, const struct word_at_a_time
*c
)
20 unsigned long mask
= (val
& c
->low_bits
) + c
->low_bits
;
24 #define create_zero_mask(mask) (mask)
26 static inline long find_zero(unsigned long mask
)
28 long leading_zero_bits
;
30 asm (PPC_CNTLZL
"%0,%1" : "=r" (leading_zero_bits
) : "r" (mask
));
31 return leading_zero_bits
>> 3;
34 static inline bool has_zero(unsigned long val
, unsigned long *data
, const struct word_at_a_time
*c
)
36 unsigned long rhs
= val
| c
->low_bits
;
38 return (val
+ c
->high_bits
) & ~rhs
;
41 #endif /* _ASM_WORD_AT_A_TIME_H */