File tree Expand file tree Collapse file tree 2 files changed +3
-14
lines changed Expand file tree Collapse file tree 2 files changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ config LINEAR_RANGES
2424
2525config PACKING
2626 bool "Generic bitfield packing and unpacking"
27+ select BITREVERSE
2728 default n
2829 help
2930 This option provides the packing() helper function, which permits
Original file line number Diff line number Diff line change 77#include <linux/bitops.h>
88#include <linux/errno.h>
99#include <linux/types.h>
10+ #include <linux/bitrev.h>
1011
1112static int get_le_offset (int offset )
1213{
@@ -29,27 +30,14 @@ static int get_reverse_lsw32_offset(int offset, size_t len)
2930 return word_index * 4 + offset ;
3031}
3132
32- static u64 bit_reverse (u64 val , unsigned int width )
33- {
34- u64 new_val = 0 ;
35- unsigned int bit ;
36- unsigned int i ;
37-
38- for (i = 0 ; i < width ; i ++ ) {
39- bit = (val & (1 << i )) != 0 ;
40- new_val |= (bit << (width - i - 1 ));
41- }
42- return new_val ;
43- }
44-
4533static void adjust_for_msb_right_quirk (u64 * to_write , int * box_start_bit ,
4634 int * box_end_bit , u8 * box_mask )
4735{
4836 int box_bit_width = * box_start_bit - * box_end_bit + 1 ;
4937 int new_box_start_bit , new_box_end_bit ;
5038
5139 * to_write >>= * box_end_bit ;
52- * to_write = bit_reverse (* to_write , box_bit_width );
40+ * to_write = bitrev8 (* to_write ) >> ( 8 - box_bit_width );
5341 * to_write <<= * box_end_bit ;
5442
5543 new_box_end_bit = box_bit_width - * box_start_bit - 1 ;
You can’t perform that action at this time.
0 commit comments