Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,7 @@ where
O: BitOrder,
{
/// Writes a new value into a single bit, using alias-safe operations.
/// Returns the previous value of the bit.
///
/// This is equivalent to [`.set()`], except that it does not require an
/// `&mut` reference, and allows bit-slices with alias-safe storage to share
Expand Down Expand Up @@ -1687,15 +1688,15 @@ where
///
/// [`.set()`]: Self::set
#[inline]
pub fn set_aliased(&self, index: usize, value: bool) {
pub fn set_aliased(&self, index: usize, value: bool) -> bool {
self.assert_in_bounds(index, 0 .. self.len());
unsafe {
self.set_aliased_unchecked(index, value);
self.set_aliased_unchecked(index, value)
}
}

/// Writes a new value into a single bit, using alias-safe operations and
/// without bounds checking.
/// without bounds checking. Returns the previous value of the bit.
///
/// This is equivalent to [`.set_unchecked()`], except that it does not
/// require an `&mut` reference, and allows bit-slices with alias-safe
Expand Down Expand Up @@ -1728,8 +1729,8 @@ where
///
/// [`.set_unchecked()`]: Self::set_unchecked
#[inline]
pub unsafe fn set_aliased_unchecked(&self, index: usize, value: bool) {
self.as_bitptr().add(index).freeze().frozen_write_bit(value);
pub unsafe fn set_aliased_unchecked(&self, index: usize, value: bool) -> bool {
self.as_bitptr().add(index).freeze().frozen_write_bit(value)
}
}

Expand Down