Skip to content

Commit

Permalink
Fix word_shift_right bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bkille committed Jun 5, 2024
1 parent 5ae65fe commit 35570e8
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions include/bitlib/bit-algorithms/bit_algorithm_details.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ RandomAccessIt word_shift_left(RandomAccessIt first,
if (n >= distance(first, last)) return first;
RandomAccessIt mid = first + n;
auto ret = std::move(mid, last, first);
//std::fill(ret, last, 0);
return ret;
}

Expand All @@ -305,12 +304,7 @@ ForwardIt word_shift_right_dispatch(ForwardIt first,
auto d = distance(first, last);
if (n <= 0) return first;
if (n >= d) return last;
ForwardIt it = first;
std::advance(it, d-n);
std::rotate(first, it, last);
it = first;
std::advance(it, n);
std::fill(first, it, 0);
std::move_backward(first, last, last - n);
return std::next(first, n);
}

Expand Down

0 comments on commit 35570e8

Please sign in to comment.