aya-obj, aya-ebpf-bindings: regenerate

libbpf commit: 20ea95b4505c477af3b6ff6ce9d19cee868ddc5d
pull/1283/head
tamird committed by Tamir Duberstein
parent eda29958f8
commit bd0424ca61

@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.71.1 */
/* automatically generated by rust-bindgen 0.72.0 */
pub type __u8 = ::core::ffi::c_uchar;
pub type __u16 = ::core::ffi::c_ushort;

@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.71.1 */
/* automatically generated by rust-bindgen 0.72.0 */
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
@ -36,7 +36,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -60,9 +62,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -89,7 +92,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -129,7 +132,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.71.1 */
/* automatically generated by rust-bindgen 0.72.0 */
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
@ -36,7 +36,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -60,9 +62,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -89,7 +92,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -129,7 +132,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.71.1 */
/* automatically generated by rust-bindgen 0.72.0 */
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
@ -36,7 +36,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -60,9 +62,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -89,7 +92,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -129,7 +132,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.71.1 */
/* automatically generated by rust-bindgen 0.72.0 */
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
@ -36,7 +36,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -60,9 +62,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -89,7 +92,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -129,7 +132,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.71.1 */
/* automatically generated by rust-bindgen 0.72.0 */
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
@ -36,7 +36,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -60,9 +62,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -89,7 +92,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -129,7 +132,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.71.1 */
/* automatically generated by rust-bindgen 0.72.0 */
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
@ -36,7 +36,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -60,9 +62,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -89,7 +92,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -129,7 +132,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.71.1 */
/* automatically generated by rust-bindgen 0.72.0 */
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
@ -36,7 +36,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -60,9 +62,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -89,7 +92,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -129,7 +132,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.71.1 */
/* automatically generated by rust-bindgen 0.72.0 */
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
@ -36,7 +36,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -60,9 +62,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -89,7 +92,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -129,7 +132,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -34,7 +34,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -58,9 +60,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -87,7 +90,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -127,7 +130,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -34,7 +34,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -58,9 +60,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -87,7 +90,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -127,7 +130,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -34,7 +34,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -58,9 +60,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -87,7 +90,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -127,7 +130,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -34,7 +34,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -58,9 +60,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -87,7 +90,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -127,7 +130,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -34,7 +34,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -58,9 +60,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -87,7 +90,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -127,7 +130,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -34,7 +34,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -58,9 +60,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -87,7 +90,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -127,7 +130,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -34,7 +34,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -58,9 +60,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -87,7 +90,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -127,7 +130,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

@ -34,7 +34,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
@ -58,9 +60,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
@ -87,7 +90,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
@ -127,7 +130,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}

Loading…
Cancel
Save