24 (v & (0xffffff
u << (24-
b)) & 0xffffff
u);
36 return (0xffffffu << (24-ceph_frag_bits(f))) & 0xffffff
u;
38 static inline __u32 ceph_frag_mask_shift(
__u32 f)
40 return 24 - ceph_frag_bits(f);
43 static inline int ceph_frag_contains_value(
__u32 f,
__u32 v)
45 return (v & ceph_frag_mask(f)) == ceph_frag_value(f);
47 static inline int ceph_frag_contains_frag(
__u32 f,
__u32 sub)
50 return ceph_frag_bits(sub) >= ceph_frag_bits(f) &&
51 (ceph_frag_value(sub) & ceph_frag_mask(f)) == ceph_frag_value(f);
56 return ceph_frag_make(ceph_frag_bits(f) - 1,
57 ceph_frag_value(f) & (ceph_frag_mask(f) << 1));
59 static inline int ceph_frag_is_left_child(
__u32 f)
61 return ceph_frag_bits(f) > 0 &&
62 (ceph_frag_value(f) & (0x1000000 >> ceph_frag_bits(f))) == 0;
64 static inline int ceph_frag_is_right_child(
__u32 f)
66 return ceph_frag_bits(f) > 0 &&
67 (ceph_frag_value(f) & (0x1000000 >> ceph_frag_bits(f))) == 1;
71 return ceph_frag_make(ceph_frag_bits(f),
72 ceph_frag_value(f) ^ (0x1000000 >> ceph_frag_bits(f)));
74 static inline __u32 ceph_frag_left_child(
__u32 f)
76 return ceph_frag_make(ceph_frag_bits(f)+1, ceph_frag_value(f));
78 static inline __u32 ceph_frag_right_child(
__u32 f)
80 return ceph_frag_make(ceph_frag_bits(f)+1,
81 ceph_frag_value(f) | (0x1000000 >> (1+ceph_frag_bits(f))));
83 static inline __u32 ceph_frag_make_child(
__u32 f,
int by,
int i)
85 int newbits = ceph_frag_bits(f) +
by;
86 return ceph_frag_make(newbits,
87 ceph_frag_value(f) | (i << (24 - newbits)));
89 static inline int ceph_frag_is_leftmost(
__u32 f)
91 return ceph_frag_value(f) == 0;
93 static inline int ceph_frag_is_rightmost(
__u32 f)
95 return ceph_frag_value(f) == ceph_frag_mask(f);
99 return ceph_frag_make(ceph_frag_bits(f),
100 ceph_frag_value(f) + (0x1000000 >> ceph_frag_bits(f)));