Fix for:
CID
1232599: Bad bit shift operation (BAD_SHIFT)
negative_shift: In expression i << (4 - split_bits) % 4, shifting by
a negative amount has undefined behavior. The shift amount,
(4 - split_bits) % 4, is -1.
CID
1232600: Bad bit shift operation (BAD_SHIFT)
negative_shift: In expression 1 << pg_num_bits - 1, shifting by a
negative amount has undefined behavior. The shift amount,
pg_num_bits - 1, is -1.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
// the below logic is inspired by rados.h#ceph_stable_mod,
// it basically determines how many sub-folders should we
// create for splitting
+ assert(pg_num_bits > 0); // otherwise BAD_SHIFT
if (((1 << (pg_num_bits - 1)) | ps) >= pg_num) {
++split_bits;
}
leavies = leavies >> 4;
}
for (uint32_t i = 0; i < subs; ++i) {
+ assert(split_bits <= 4); // otherwise BAD_SHIFT
int v = tmp_id | (i << ((4 - split_bits) % 4));
paths.push_back(to_hex(v));
ret = create_path(paths);