This source file includes following definitions.
- has_zero
- prep_zero_mask
- create_zero_mask
- find_zero
1
2
3
4
5
6
7
8 #ifndef _ASM_RISCV_WORD_AT_A_TIME_H
9 #define _ASM_RISCV_WORD_AT_A_TIME_H
10
11
12 #include <linux/kernel.h>
13
14 struct word_at_a_time {
15 const unsigned long one_bits, high_bits;
16 };
17
18 #define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE(0x01), REPEAT_BYTE(0x80) }
19
20 static inline unsigned long has_zero(unsigned long val,
21 unsigned long *bits, const struct word_at_a_time *c)
22 {
23 unsigned long mask = ((val - c->one_bits) & ~val) & c->high_bits;
24 *bits = mask;
25 return mask;
26 }
27
28 static inline unsigned long prep_zero_mask(unsigned long val,
29 unsigned long bits, const struct word_at_a_time *c)
30 {
31 return bits;
32 }
33
34 static inline unsigned long create_zero_mask(unsigned long bits)
35 {
36 bits = (bits - 1) & ~bits;
37 return bits >> 7;
38 }
39
40 static inline unsigned long find_zero(unsigned long mask)
41 {
42 return fls64(mask) >> 3;
43 }
44
45
46 #define zero_bytemask(mask) (mask)
47
48 #endif