Repository: rust-lang/rust-bindgen
Pull request #2988 (2024-11-22 22:23:15)

Add `raw_ref_macros` feature
This feature was stabilized in rust 1.51 and adds the `addr_of` and `addr_of_mut` macros.

Without these changes, `bindgen` cannot generate code that's valid for Rust versions lower than 1.51 in certain contexts.



Patch:
diff --git a/bindgen/codegen/bitfield_unit.rs b/bindgen/codegen/bitfield_unit.rs
index 3411c22e..59c66f8c 100644
--- a/bindgen/codegen/bitfield_unit.rs
+++ b/bindgen/codegen/bitfield_unit.rs
@@ -38,17 +38,6 @@ where
         Self::extract_bit(byte, index)
     }
 
-    #[inline]
-    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);
-
-        Self::extract_bit(byte, index)
-    }
-
     #[inline]
     fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
         let bit_index = if cfg!(target_endian = "big") {
@@ -75,17 +64,6 @@ where
         *byte = Self::change_bit(*byte, index, val);
     }
 
-    #[inline]
-    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);
-    }
-
     #[inline]
     pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
         debug_assert!(bit_width <= 64);
@@ -111,35 +89,6 @@ where
         val
     }
 
-    #[inline]
-    pub unsafe fn raw_get(
-        this: *const Self,
-        bit_offset: usize,
-        bit_width: u8,
-    ) -> u64 {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        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) {
-                let index = if cfg!(target_endian = "big") {
-                    bit_width as usize - 1 - i
-                } else {
-                    i
-                };
-                val |= 1 << index;
-            }
-        }
-
-        val
-    }
-
     #[inline]
     pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
         debug_assert!(bit_width <= 64);
@@ -160,30 +109,4 @@ where
             self.set_bit(index + bit_offset, val_bit_is_set);
         }
     }
-
-    #[inline]
-    pub unsafe fn raw_set(
-        this: *mut Self,
-        bit_offset: usize,
-        bit_width: u8,
-        val: u64,
-    ) {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        debug_assert!(
-            (bit_offset + (bit_width as usize)) / 8 <=
-                core::mem::size_of::<Storage>()
-        );
-
-        for i in 0..(bit_width as usize) {
-            let mask = 1 << i;
-            let val_bit_is_set = val & mask == mask;
-            let index = if cfg!(target_endian = "big") {
-                bit_width as usize - 1 - i
-            } else {
-                i
-            };
-            Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
-        }
-    }
 }
diff --git a/bindgen/codegen/bitfield_unit_raw_ref_macros.rs b/bindgen/codegen/bitfield_unit_raw_ref_macros.rs
new file mode 100644
index 00000000..3411c22e
--- /dev/null
+++ b/bindgen/codegen/bitfield_unit_raw_ref_macros.rs
@@ -0,0 +1,189 @@
+#[repr(C)]
+#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
+pub struct __BindgenBitfieldUnit<Storage> {
+    storage: Storage,
+}
+
+impl<Storage> __BindgenBitfieldUnit<Storage> {
+    #[inline]
+    pub const fn new(storage: Storage) -> Self {
+        Self { storage }
+    }
+}
+
+impl<Storage> __BindgenBitfieldUnit<Storage>
+where
+    Storage: AsRef<[u8]> + AsMut<[u8]>,
+{
+    #[inline]
+    fn extract_bit(byte: u8, index: usize) -> bool {
+        let bit_index = if cfg!(target_endian = "big") {
+            7 - (index % 8)
+        } else {
+            index % 8
+        };
+
+        let mask = 1 << bit_index;
+
+        byte & mask == mask
+    }
+
+    #[inline]
+    pub fn get_bit(&self, index: usize) -> bool {
+        debug_assert!(index / 8 < self.storage.as_ref().len());
+
+        let byte_index = index / 8;
+        let byte = self.storage.as_ref()[byte_index];
+
+        Self::extract_bit(byte, index)
+    }
+
+    #[inline]
+    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);
+
+        Self::extract_bit(byte, index)
+    }
+
+    #[inline]
+    fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
+        let bit_index = if cfg!(target_endian = "big") {
+            7 - (index % 8)
+        } else {
+            index % 8
+        };
+
+        let mask = 1 << bit_index;
+        if val {
+            byte | mask
+        } else {
+            byte & !mask
+        }
+    }
+
+    #[inline]
+    pub fn set_bit(&mut self, index: usize, val: bool) {
+        debug_assert!(index / 8 < self.storage.as_ref().len());
+
+        let byte_index = index / 8;
+        let byte = &mut self.storage.as_mut()[byte_index];
+
+        *byte = Self::change_bit(*byte, index, val);
+    }
+
+    #[inline]
+    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);
+    }
+
+    #[inline]
+    pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
+        debug_assert!(bit_width <= 64);
+        debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
+        debug_assert!(
+            (bit_offset + (bit_width as usize)) / 8 <=
+                self.storage.as_ref().len()
+        );
+
+        let mut val = 0;
+
+        for i in 0..(bit_width as usize) {
+            if self.get_bit(i + bit_offset) {
+                let index = if cfg!(target_endian = "big") {
+                    bit_width as usize - 1 - i
+                } else {
+                    i
+                };
+                val |= 1 << index;
+            }
+        }
+
+        val
+    }
+
+    #[inline]
+    pub unsafe fn raw_get(
+        this: *const Self,
+        bit_offset: usize,
+        bit_width: u8,
+    ) -> u64 {
+        debug_assert!(bit_width <= 64);
+        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
+        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) {
+                let index = if cfg!(target_endian = "big") {
+                    bit_width as usize - 1 - i
+                } else {
+                    i
+                };
+                val |= 1 << index;
+            }
+        }
+
+        val
+    }
+
+    #[inline]
+    pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
+        debug_assert!(bit_width <= 64);
+        debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
+        debug_assert!(
+            (bit_offset + (bit_width as usize)) / 8 <=
+                self.storage.as_ref().len()
+        );
+
+        for i in 0..(bit_width as usize) {
+            let mask = 1 << i;
+            let val_bit_is_set = val & mask == mask;
+            let index = if cfg!(target_endian = "big") {
+                bit_width as usize - 1 - i
+            } else {
+                i
+            };
+            self.set_bit(index + bit_offset, val_bit_is_set);
+        }
+    }
+
+    #[inline]
+    pub unsafe fn raw_set(
+        this: *mut Self,
+        bit_offset: usize,
+        bit_width: u8,
+        val: u64,
+    ) {
+        debug_assert!(bit_width <= 64);
+        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
+        debug_assert!(
+            (bit_offset + (bit_width as usize)) / 8 <=
+                core::mem::size_of::<Storage>()
+        );
+
+        for i in 0..(bit_width as usize) {
+            let mask = 1 << i;
+            let val_bit_is_set = val & mask == mask;
+            let index = if cfg!(target_endian = "big") {
+                bit_width as usize - 1 - i
+            } else {
+                i
+            };
+            Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
+        }
+    }
+}
diff --git a/bindgen/codegen/mod.rs b/bindgen/codegen/mod.rs
index 4cab8773..ccc5758a 100644
--- a/bindgen/codegen/mod.rs
+++ b/bindgen/codegen/mod.rs
@@ -2008,31 +2008,35 @@ impl<'a> FieldCodegen<'a> for Bitfield {
                         )
                     }
                 }
+            }));
 
-                #[inline]
-                #access_spec unsafe fn #raw_getter_name(this: *const Self) -> #bitfield_ty {
-                    unsafe {
-                        ::#prefix::mem::transmute(<#unit_field_ty>::raw_get(
-                            (*::#prefix::ptr::addr_of!((*this).#unit_field_ident)).as_ref() as *const _,
-                            #offset,
-                            #width,
-                        ) as #bitfield_int_ty)
+            if ctx.options().rust_features.raw_ref_macros {
+                methods.extend(Some(quote! {
+                    #[inline]
+                    #access_spec unsafe fn #raw_getter_name(this: *const Self) -> #bitfield_ty {
+                        unsafe {
+                            ::#prefix::mem::transmute(<#unit_field_ty>::raw_get(
+                                (*::#prefix::ptr::addr_of!((*this).#unit_field_ident)).as_ref() as *const _,
+                                #offset,
+                                #width,
+                            ) as #bitfield_int_ty)
+                        }
                     }
-                }
 
-                #[inline]
-                #access_spec unsafe fn #raw_setter_name(this: *mut Self, val: #bitfield_ty) {
-                    unsafe {
-                        let val: #bitfield_int_ty = ::#prefix::mem::transmute(val);
-                        <#unit_field_ty>::raw_set(
-                            (*::#prefix::ptr::addr_of_mut!((*this).#unit_field_ident)).as_mut() as *mut _,
-                            #offset,
-                            #width,
-                            val as u64,
-                        )
+                    #[inline]
+                    #access_spec unsafe fn #raw_setter_name(this: *mut Self, val: #bitfield_ty) {
+                        unsafe {
+                            let val: #bitfield_int_ty = ::#prefix::mem::transmute(val);
+                            <#unit_field_ty>::raw_set(
+                                (*::#prefix::ptr::addr_of_mut!((*this).#unit_field_ident)).as_mut() as *mut _,
+                                #offset,
+                                #width,
+                                val as u64,
+                            )
+                        }
                     }
-                }
-            }));
+                }));
+            }
         } else {
             methods.extend(Some(quote! {
                 #[inline]
@@ -2056,7 +2060,10 @@ impl<'a> FieldCodegen<'a> for Bitfield {
                         )
                     }
                 }
+            }));
 
+            if ctx.options().rust_features.raw_ref_macros {
+                methods.extend(Some(quote! {
                 #[inline]
                 #access_spec unsafe fn #raw_getter_name(this: *const Self) -> #bitfield_ty {
                     unsafe {
@@ -2081,6 +2088,7 @@ impl<'a> FieldCodegen<'a> for Bitfield {
                     }
                 }
             }));
+            }
         }
     }
 }
@@ -5302,7 +5310,12 @@ pub(crate) mod utils {
             return;
         }
 
-        let bitfield_unit_src = include_str!("./bitfield_unit.rs");
+        let bitfield_unit_src = if ctx.options().rust_features().raw_ref_macros
+        {
+            include_str!("./bitfield_unit_raw_ref_macros.rs")
+        } else {
+            include_str!("./bitfield_unit.rs")
+        };
         let bitfield_unit_src = if ctx.options().rust_features().min_const_fn {
             Cow::Borrowed(bitfield_unit_src)
         } else {
diff --git a/bindgen/features.rs b/bindgen/features.rs
index 990e4513..e67b00f0 100644
--- a/bindgen/features.rs
+++ b/bindgen/features.rs
@@ -104,6 +104,7 @@ define_rust_targets! {
     Stable_1_71(71) => { c_unwind_abi: #106075 },
     Stable_1_68(68) => { abi_efiapi: #105795 },
     Stable_1_64(64) => { core_ffi_c: #94503 },
+    Stable_1_51(51) => { raw_ref_macros: #80886 },
     Stable_1_59(59) => { const_cstr: #54745 },
     Stable_1_47(47) => { larger_arrays: #74060 },
     Stable_1_43(43) => { associated_constants: #68952 },


Test patch:
diff --git a/bindgen-tests/tests/expectations/tests/derive-bitfield-method-same-name.rs b/bindgen-tests/tests/expectations/tests/derive-bitfield-method-same-name.rs
index 88b9ceaa..c8f19bc5 100644
--- a/bindgen-tests/tests/expectations/tests/derive-bitfield-method-same-name.rs
+++ b/bindgen-tests/tests/expectations/tests/derive-bitfield-method-same-name.rs
@@ -32,14 +32,6 @@ where
         Self::extract_bit(byte, index)
     }
     #[inline]
-    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);
-        Self::extract_bit(byte, index)
-    }
-    #[inline]
     fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
         let bit_index = if cfg!(target_endian = "big") {
             7 - (index % 8)
@@ -57,14 +49,6 @@ where
         *byte = Self::change_bit(*byte, index, val);
     }
     #[inline]
-    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);
-    }
-    #[inline]
     pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -85,26 +69,6 @@ where
         val
     }
     #[inline]
-    pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        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) {
-                let index = if cfg!(target_endian = "big") {
-                    bit_width as usize - 1 - i
-                } else {
-                    i
-                };
-                val |= 1 << index;
-            }
-        }
-        val
-    }
-    #[inline]
     pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -122,24 +86,6 @@ where
             self.set_bit(index + bit_offset, val_bit_is_set);
         }
     }
-    #[inline]
-    pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        debug_assert!(
-            (bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>(),
-        );
-        for i in 0..(bit_width as usize) {
-            let mask = 1 << i;
-            let val_bit_is_set = val & mask == mask;
-            let index = if cfg!(target_endian = "big") {
-                bit_width as usize - 1 - i
-            } else {
-                i
-            };
-            Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
-        }
-    }
 }
 /** Because this struct have array larger than 32 items
  and --with-derive-partialeq --impl-partialeq --impl-debug is provided,
@@ -219,35 +165,6 @@ impl Foo {
         }
     }
     #[inline]
-    pub unsafe fn type__bindgen_bitfield_raw(
-        this: *const Self,
-    ) -> ::std::os::raw::c_char {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 0usize, 3u8) as u8,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_type__bindgen_bitfield_raw(
-        this: *mut Self,
-        val: ::std::os::raw::c_char,
-    ) {
-        unsafe {
-            let val: u8 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                0usize,
-                3u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn new_bitfield_1(
         type__bindgen_bitfield: ::std::os::raw::c_char,
     ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
diff --git a/bindgen-tests/tests/expectations/tests/derive-debug-bitfield-1-51.rs b/bindgen-tests/tests/expectations/tests/derive-debug-bitfield-1-51.rs
new file mode 100644
index 00000000..fa007056
--- /dev/null
+++ b/bindgen-tests/tests/expectations/tests/derive-debug-bitfield-1-51.rs
@@ -0,0 +1,266 @@
+#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
+#[repr(C)]
+#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
+pub struct __BindgenBitfieldUnit<Storage> {
+    storage: Storage,
+}
+impl<Storage> __BindgenBitfieldUnit<Storage> {
+    #[inline]
+    pub const fn new(storage: Storage) -> Self {
+        Self { storage }
+    }
+}
+impl<Storage> __BindgenBitfieldUnit<Storage>
+where
+    Storage: AsRef<[u8]> + AsMut<[u8]>,
+{
+    #[inline]
+    fn extract_bit(byte: u8, index: usize) -> bool {
+        let bit_index = if cfg!(target_endian = "big") {
+            7 - (index % 8)
+        } else {
+            index % 8
+        };
+        let mask = 1 << bit_index;
+        byte & mask == mask
+    }
+    #[inline]
+    pub fn get_bit(&self, index: usize) -> bool {
+        debug_assert!(index / 8 < self.storage.as_ref().len());
+        let byte_index = index / 8;
+        let byte = self.storage.as_ref()[byte_index];
+        Self::extract_bit(byte, index)
+    }
+    #[inline]
+    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);
+        Self::extract_bit(byte, index)
+    }
+    #[inline]
+    fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
+        let bit_index = if cfg!(target_endian = "big") {
+            7 - (index % 8)
+        } else {
+            index % 8
+        };
+        let mask = 1 << bit_index;
+        if val { byte | mask } else { byte & !mask }
+    }
+    #[inline]
+    pub fn set_bit(&mut self, index: usize, val: bool) {
+        debug_assert!(index / 8 < self.storage.as_ref().len());
+        let byte_index = index / 8;
+        let byte = &mut self.storage.as_mut()[byte_index];
+        *byte = Self::change_bit(*byte, index, val);
+    }
+    #[inline]
+    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);
+    }
+    #[inline]
+    pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
+        debug_assert!(bit_width <= 64);
+        debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
+        debug_assert!(
+            (bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
+        );
+        let mut val = 0;
+        for i in 0..(bit_width as usize) {
+            if self.get_bit(i + bit_offset) {
+                let index = if cfg!(target_endian = "big") {
+                    bit_width as usize - 1 - i
+                } else {
+                    i
+                };
+                val |= 1 << index;
+            }
+        }
+        val
+    }
+    #[inline]
+    pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
+        debug_assert!(bit_width <= 64);
+        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
+        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) {
+                let index = if cfg!(target_endian = "big") {
+                    bit_width as usize - 1 - i
+                } else {
+                    i
+                };
+                val |= 1 << index;
+            }
+        }
+        val
+    }
+    #[inline]
+    pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
+        debug_assert!(bit_width <= 64);
+        debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
+        debug_assert!(
+            (bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
+        );
+        for i in 0..(bit_width as usize) {
+            let mask = 1 << i;
+            let val_bit_is_set = val & mask == mask;
+            let index = if cfg!(target_endian = "big") {
+                bit_width as usize - 1 - i
+            } else {
+                i
+            };
+            self.set_bit(index + bit_offset, val_bit_is_set);
+        }
+    }
+    #[inline]
+    pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
+        debug_assert!(bit_width <= 64);
+        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
+        debug_assert!(
+            (bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>(),
+        );
+        for i in 0..(bit_width as usize) {
+            let mask = 1 << i;
+            let val_bit_is_set = val & mask == mask;
+            let index = if cfg!(target_endian = "big") {
+                bit_width as usize - 1 - i
+            } else {
+                i
+            };
+            Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
+        }
+    }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct C {
+    pub _bitfield_align_1: [u8; 0],
+    pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
+    pub large_array: [::std::os::raw::c_int; 50usize],
+}
+#[test]
+fn bindgen_test_layout_C() {
+    const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit();
+    let ptr = UNINIT.as_ptr();
+    assert_eq!(::std::mem::size_of::<C>(), 204usize, "Size of C");
+    assert_eq!(::std::mem::align_of::<C>(), 4usize, "Alignment of C");
+    assert_eq!(
+        unsafe { ::std::ptr::addr_of!((*ptr).large_array) as usize - ptr as usize },
+        4usize,
+        "Offset of field: C::large_array",
+    );
+}
+impl Default for C {
+    fn default() -> Self {
+        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}
+impl C {
+    #[inline]
+    pub fn a(&self) -> bool {
+        unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
+    }
+    #[inline]
+    pub fn set_a(&mut self, val: bool) {
+        unsafe {
+            let val: u8 = ::std::mem::transmute(val);
+            self._bitfield_1.set(0usize, 1u8, val as u64)
+        }
+    }
+    #[inline]
+    pub unsafe fn a_raw(this: *const Self) -> bool {
+        unsafe {
+            ::std::mem::transmute(
+                <__BindgenBitfieldUnit<
+                    [u8; 1usize],
+                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 0usize, 1u8) as u8,
+            )
+        }
+    }
+    #[inline]
+    pub unsafe fn set_a_raw(this: *mut Self, val: bool) {
+        unsafe {
+            let val: u8 = ::std::mem::transmute(val);
+            <__BindgenBitfieldUnit<
+                [u8; 1usize],
+            >>::raw_set(
+                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
+                0usize,
+                1u8,
+                val as u64,
+            )
+        }
+    }
+    #[inline]
+    pub fn b(&self) -> bool {
+        unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) }
+    }
+    #[inline]
+    pub fn set_b(&mut self, val: bool) {
+        unsafe {
+            let val: u8 = ::std::mem::transmute(val);
+            self._bitfield_1.set(1usize, 7u8, val as u64)
+        }
+    }
+    #[inline]
+    pub unsafe fn b_raw(this: *const Self) -> bool {
+        unsafe {
+            ::std::mem::transmute(
+                <__BindgenBitfieldUnit<
+                    [u8; 1usize],
+                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 1usize, 7u8) as u8,
+            )
+        }
+    }
+    #[inline]
+    pub unsafe fn set_b_raw(this: *mut Self, val: bool) {
+        unsafe {
+            let val: u8 = ::std::mem::transmute(val);
+            <__BindgenBitfieldUnit<
+                [u8; 1usize],
+            >>::raw_set(
+                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
+                1usize,
+                7u8,
+                val as u64,
+            )
+        }
+    }
+    #[inline]
+    pub fn new_bitfield_1(a: bool, b: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
+        let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
+        __bindgen_bitfield_unit
+            .set(
+                0usize,
+                1u8,
+                {
+                    let a: u8 = unsafe { ::std::mem::transmute(a) };
+                    a as u64
+                },
+            );
+        __bindgen_bitfield_unit
+            .set(
+                1usize,
+                7u8,
+                {
+                    let b: u8 = unsafe { ::std::mem::transmute(b) };
+                    b as u64
+                },
+            );
+        __bindgen_bitfield_unit
+    }
+}
diff --git a/bindgen-tests/tests/expectations/tests/derive-debug-bitfield-core.rs b/bindgen-tests/tests/expectations/tests/derive-debug-bitfield-core.rs
index e88d1d6d..edcb4e2a 100644
--- a/bindgen-tests/tests/expectations/tests/derive-debug-bitfield-core.rs
+++ b/bindgen-tests/tests/expectations/tests/derive-debug-bitfield-core.rs
@@ -33,14 +33,6 @@ where
         Self::extract_bit(byte, index)
     }
     #[inline]
-    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);
-        Self::extract_bit(byte, index)
-    }
-    #[inline]
     fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
         let bit_index = if cfg!(target_endian = "big") {
             7 - (index % 8)
@@ -58,14 +50,6 @@ where
         *byte = Self::change_bit(*byte, index, val);
     }
     #[inline]
-    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);
-    }
-    #[inline]
     pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -86,26 +70,6 @@ where
         val
     }
     #[inline]
-    pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        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) {
-                let index = if cfg!(target_endian = "big") {
-                    bit_width as usize - 1 - i
-                } else {
-                    i
-                };
-                val |= 1 << index;
-            }
-        }
-        val
-    }
-    #[inline]
     pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -123,24 +87,6 @@ where
             self.set_bit(index + bit_offset, val_bit_is_set);
         }
     }
-    #[inline]
-    pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        debug_assert!(
-            (bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>(),
-        );
-        for i in 0..(bit_width as usize) {
-            let mask = 1 << i;
-            let val_bit_is_set = val & mask == mask;
-            let index = if cfg!(target_endian = "big") {
-                bit_width as usize - 1 - i
-            } else {
-                i
-            };
-            Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
-        }
-    }
 }
 #[repr(C)]
 #[derive(Copy, Clone)]
@@ -188,31 +134,6 @@ impl C {
         }
     }
     #[inline]
-    pub unsafe fn a_raw(this: *const Self) -> bool {
-        unsafe {
-            ::core::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 1usize],
-                >>::raw_get(::core::ptr::addr_of!((*this)._bitfield_1), 0usize, 1u8)
-                    as u8,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_a_raw(this: *mut Self, val: bool) {
-        unsafe {
-            let val: u8 = ::core::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 1usize],
-            >>::raw_set(
-                ::core::ptr::addr_of_mut!((*this)._bitfield_1),
-                0usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn b(&self) -> bool {
         unsafe { ::core::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) }
     }
@@ -224,31 +145,6 @@ impl C {
         }
     }
     #[inline]
-    pub unsafe fn b_raw(this: *const Self) -> bool {
-        unsafe {
-            ::core::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 1usize],
-                >>::raw_get(::core::ptr::addr_of!((*this)._bitfield_1), 1usize, 7u8)
-                    as u8,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_b_raw(this: *mut Self, val: bool) {
-        unsafe {
-            let val: u8 = ::core::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 1usize],
-            >>::raw_set(
-                ::core::ptr::addr_of_mut!((*this)._bitfield_1),
-                1usize,
-                7u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn new_bitfield_1(a: bool, b: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
         let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
         __bindgen_bitfield_unit
diff --git a/bindgen-tests/tests/expectations/tests/derive-debug-bitfield.rs b/bindgen-tests/tests/expectations/tests/derive-debug-bitfield.rs
index 09ca288b..20c7cf0c 100644
--- a/bindgen-tests/tests/expectations/tests/derive-debug-bitfield.rs
+++ b/bindgen-tests/tests/expectations/tests/derive-debug-bitfield.rs
@@ -32,14 +32,6 @@ where
         Self::extract_bit(byte, index)
     }
     #[inline]
-    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);
-        Self::extract_bit(byte, index)
-    }
-    #[inline]
     fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
         let bit_index = if cfg!(target_endian = "big") {
             7 - (index % 8)
@@ -57,14 +49,6 @@ where
         *byte = Self::change_bit(*byte, index, val);
     }
     #[inline]
-    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);
-    }
-    #[inline]
     pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -85,26 +69,6 @@ where
         val
     }
     #[inline]
-    pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        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) {
-                let index = if cfg!(target_endian = "big") {
-                    bit_width as usize - 1 - i
-                } else {
-                    i
-                };
-                val |= 1 << index;
-            }
-        }
-        val
-    }
-    #[inline]
     pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -122,24 +86,6 @@ where
             self.set_bit(index + bit_offset, val_bit_is_set);
         }
     }
-    #[inline]
-    pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        debug_assert!(
-            (bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>(),
-        );
-        for i in 0..(bit_width as usize) {
-            let mask = 1 << i;
-            let val_bit_is_set = val & mask == mask;
-            let index = if cfg!(target_endian = "big") {
-                bit_width as usize - 1 - i
-            } else {
-                i
-            };
-            Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
-        }
-    }
 }
 #[repr(C)]
 #[derive(Copy, Clone)]
@@ -198,30 +144,6 @@ impl C {
         }
     }
     #[inline]
-    pub unsafe fn a_raw(this: *const Self) -> bool {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 1usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 0usize, 1u8) as u8,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_a_raw(this: *mut Self, val: bool) {
-        unsafe {
-            let val: u8 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 1usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                0usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn b(&self) -> bool {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) }
     }
@@ -233,30 +155,6 @@ impl C {
         }
     }
     #[inline]
-    pub unsafe fn b_raw(this: *const Self) -> bool {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 1usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 1usize, 7u8) as u8,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_b_raw(this: *mut Self, val: bool) {
-        unsafe {
-            let val: u8 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 1usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                1usize,
-                7u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn new_bitfield_1(a: bool, b: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
         let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
         __bindgen_bitfield_unit
diff --git a/bindgen-tests/tests/expectations/tests/derive-partialeq-bitfield.rs b/bindgen-tests/tests/expectations/tests/derive-partialeq-bitfield.rs
index b27a9bb3..eaf3f45e 100644
--- a/bindgen-tests/tests/expectations/tests/derive-partialeq-bitfield.rs
+++ b/bindgen-tests/tests/expectations/tests/derive-partialeq-bitfield.rs
@@ -32,14 +32,6 @@ where
         Self::extract_bit(byte, index)
     }
     #[inline]
-    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);
-        Self::extract_bit(byte, index)
-    }
-    #[inline]
     fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
         let bit_index = if cfg!(target_endian = "big") {
             7 - (index % 8)
@@ -57,14 +49,6 @@ where
         *byte = Self::change_bit(*byte, index, val);
     }
     #[inline]
-    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);
-    }
-    #[inline]
     pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -85,26 +69,6 @@ where
         val
     }
     #[inline]
-    pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        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) {
-                let index = if cfg!(target_endian = "big") {
-                    bit_width as usize - 1 - i
-                } else {
-                    i
-                };
-                val |= 1 << index;
-            }
-        }
-        val
-    }
-    #[inline]
     pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -122,24 +86,6 @@ where
             self.set_bit(index + bit_offset, val_bit_is_set);
         }
     }
-    #[inline]
-    pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        debug_assert!(
-            (bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>(),
-        );
-        for i in 0..(bit_width as usize) {
-            let mask = 1 << i;
-            let val_bit_is_set = val & mask == mask;
-            let index = if cfg!(target_endian = "big") {
-                bit_width as usize - 1 - i
-            } else {
-                i
-            };
-            Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
-        }
-    }
 }
 #[repr(C)]
 #[derive(Copy, Clone)]
@@ -188,30 +134,6 @@ impl C {
         }
     }
     #[inline]
-    pub unsafe fn a_raw(this: *const Self) -> bool {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 1usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 0usize, 1u8) as u8,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_a_raw(this: *mut Self, val: bool) {
-        unsafe {
-            let val: u8 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 1usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                0usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn b(&self) -> bool {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) }
     }
@@ -223,30 +145,6 @@ impl C {
         }
     }
     #[inline]
-    pub unsafe fn b_raw(this: *const Self) -> bool {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 1usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 1usize, 7u8) as u8,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_b_raw(this: *mut Self, val: bool) {
-        unsafe {
-            let val: u8 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 1usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                1usize,
-                7u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn new_bitfield_1(a: bool, b: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
         let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
         __bindgen_bitfield_unit
diff --git a/bindgen-tests/tests/expectations/tests/jsval_layout_opaque_1_0.rs b/bindgen-tests/tests/expectations/tests/jsval_layout_opaque_1_0.rs
index 5da0e799..422782d6 100644
--- a/bindgen-tests/tests/expectations/tests/jsval_layout_opaque_1_0.rs
+++ b/bindgen-tests/tests/expectations/tests/jsval_layout_opaque_1_0.rs
@@ -32,14 +32,6 @@ where
         Self::extract_bit(byte, index)
     }
     #[inline]
-    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);
-        Self::extract_bit(byte, index)
-    }
-    #[inline]
     fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
         let bit_index = if cfg!(target_endian = "big") {
             7 - (index % 8)
@@ -57,14 +49,6 @@ where
         *byte = Self::change_bit(*byte, index, val);
     }
     #[inline]
-    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);
-    }
-    #[inline]
     pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -85,26 +69,6 @@ where
         val
     }
     #[inline]
-    pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        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) {
-                let index = if cfg!(target_endian = "big") {
-                    bit_width as usize - 1 - i
-                } else {
-                    i
-                };
-                val |= 1 << index;
-            }
-        }
-        val
-    }
-    #[inline]
     pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -122,24 +86,6 @@ where
             self.set_bit(index + bit_offset, val_bit_is_set);
         }
     }
-    #[inline]
-    pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        debug_assert!(
-            (bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>(),
-        );
-        for i in 0..(bit_width as usize) {
-            let mask = 1 << i;
-            let val_bit_is_set = val & mask == mask;
-            let index = if cfg!(target_endian = "big") {
-                bit_width as usize - 1 - i
-            } else {
-                i
-            };
-            Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
-        }
-    }
 }
 #[repr(C)]
 pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
@@ -328,31 +274,6 @@ impl jsval_layout__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn payload47_raw(this: *const Self) -> u64 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 8usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 0usize, 47u8)
-                    as u64,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_payload47_raw(this: *mut Self, val: u64) {
-        unsafe {
-            let val: u64 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 8usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                0usize,
-                47u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn tag(&self) -> JSValueTag {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(47usize, 17u8) as u32) }
     }
@@ -364,31 +285,6 @@ impl jsval_layout__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn tag_raw(this: *const Self) -> JSValueTag {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 8usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 47usize, 17u8)
-                    as u32,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_tag_raw(this: *mut Self, val: JSValueTag) {
-        unsafe {
-            let val: u32 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 8usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                47usize,
-                17u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn new_bitfield_1(
         payload47: u64,
         tag: JSValueTag,
diff --git a/bindgen-tests/tests/expectations/tests/layout_eth_conf.rs b/bindgen-tests/tests/expectations/tests/layout_eth_conf.rs
index d9d30e1d..4a62ddbe 100644
--- a/bindgen-tests/tests/expectations/tests/layout_eth_conf.rs
+++ b/bindgen-tests/tests/expectations/tests/layout_eth_conf.rs
@@ -32,14 +32,6 @@ where
         Self::extract_bit(byte, index)
     }
     #[inline]
-    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);
-        Self::extract_bit(byte, index)
-    }
-    #[inline]
     fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
         let bit_index = if cfg!(target_endian = "big") {
             7 - (index % 8)
@@ -57,14 +49,6 @@ where
         *byte = Self::change_bit(*byte, index, val);
     }
     #[inline]
-    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);
-    }
-    #[inline]
     pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -85,26 +69,6 @@ where
         val
     }
     #[inline]
-    pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        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) {
-                let index = if cfg!(target_endian = "big") {
-                    bit_width as usize - 1 - i
-                } else {
-                    i
-                };
-                val |= 1 << index;
-            }
-        }
-        val
-    }
-    #[inline]
     pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -122,24 +86,6 @@ where
             self.set_bit(index + bit_offset, val_bit_is_set);
         }
     }
-    #[inline]
-    pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        debug_assert!(
-            (bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>(),
-        );
-        for i in 0..(bit_width as usize) {
-            let mask = 1 << i;
-            let val_bit_is_set = val & mask == mask;
-            let index = if cfg!(target_endian = "big") {
-                bit_width as usize - 1 - i
-            } else {
-                i
-            };
-            Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
-        }
-    }
 }
 pub const ETH_MQ_RX_RSS_FLAG: u32 = 1;
 pub const ETH_MQ_RX_DCB_FLAG: u32 = 2;
@@ -260,31 +206,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn header_split_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 0usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_header_split_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                0usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn hw_ip_checksum(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u16) }
     }
@@ -296,31 +217,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_ip_checksum_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 1usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_ip_checksum_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                1usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn hw_vlan_filter(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u16) }
     }
@@ -332,31 +228,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_vlan_filter_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 2usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_vlan_filter_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                2usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn hw_vlan_strip(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u16) }
     }
@@ -368,31 +239,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_vlan_strip_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 3usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_vlan_strip_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                3usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn hw_vlan_extend(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u16) }
     }
@@ -404,31 +250,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_vlan_extend_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 4usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_vlan_extend_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                4usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn jumbo_frame(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u16) }
     }
@@ -440,31 +261,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn jumbo_frame_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 5usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_jumbo_frame_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                5usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn hw_strip_crc(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u16) }
     }
@@ -476,31 +272,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_strip_crc_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 6usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_strip_crc_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                6usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn enable_scatter(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u16) }
     }
@@ -512,31 +283,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn enable_scatter_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 7usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_enable_scatter_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                7usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn enable_lro(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u16) }
     }
@@ -548,31 +294,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn enable_lro_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 8usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_enable_lro_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                8usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn new_bitfield_1(
         header_split: u16,
         hw_ip_checksum: u16,
@@ -755,30 +476,6 @@ impl rte_eth_txmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_vlan_reject_tagged_raw(this: *const Self) -> u8 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 1usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 0usize, 1u8) as u8,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_vlan_reject_tagged_raw(this: *mut Self, val: u8) {
-        unsafe {
-            let val: u8 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 1usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                0usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn hw_vlan_reject_untagged(&self) -> u8 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
     }
@@ -790,30 +487,6 @@ impl rte_eth_txmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_vlan_reject_untagged_raw(this: *const Self) -> u8 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 1usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 1usize, 1u8) as u8,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_vlan_reject_untagged_raw(this: *mut Self, val: u8) {
-        unsafe {
-            let val: u8 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 1usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                1usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn hw_vlan_insert_pvid(&self) -> u8 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
     }
@@ -825,30 +498,6 @@ impl rte_eth_txmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_vlan_insert_pvid_raw(this: *const Self) -> u8 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 1usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 2usize, 1u8) as u8,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_vlan_insert_pvid_raw(this: *mut Self, val: u8) {
-        unsafe {
-            let val: u8 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 1usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                2usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn new_bitfield_1(
         hw_vlan_reject_tagged: u8,
         hw_vlan_reject_untagged: u8,
diff --git a/bindgen-tests/tests/expectations/tests/layout_eth_conf_1_0.rs b/bindgen-tests/tests/expectations/tests/layout_eth_conf_1_0.rs
index c5ccdd09..6cbeb042 100644
--- a/bindgen-tests/tests/expectations/tests/layout_eth_conf_1_0.rs
+++ b/bindgen-tests/tests/expectations/tests/layout_eth_conf_1_0.rs
@@ -32,14 +32,6 @@ where
         Self::extract_bit(byte, index)
     }
     #[inline]
-    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);
-        Self::extract_bit(byte, index)
-    }
-    #[inline]
     fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
         let bit_index = if cfg!(target_endian = "big") {
             7 - (index % 8)
@@ -57,14 +49,6 @@ where
         *byte = Self::change_bit(*byte, index, val);
     }
     #[inline]
-    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);
-    }
-    #[inline]
     pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -85,26 +69,6 @@ where
         val
     }
     #[inline]
-    pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        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) {
-                let index = if cfg!(target_endian = "big") {
-                    bit_width as usize - 1 - i
-                } else {
-                    i
-                };
-                val |= 1 << index;
-            }
-        }
-        val
-    }
-    #[inline]
     pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -122,24 +86,6 @@ where
             self.set_bit(index + bit_offset, val_bit_is_set);
         }
     }
-    #[inline]
-    pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        debug_assert!(
-            (bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>(),
-        );
-        for i in 0..(bit_width as usize) {
-            let mask = 1 << i;
-            let val_bit_is_set = val & mask == mask;
-            let index = if cfg!(target_endian = "big") {
-                bit_width as usize - 1 - i
-            } else {
-                i
-            };
-            Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
-        }
-    }
 }
 #[repr(C)]
 pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
@@ -308,31 +254,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn header_split_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 0usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_header_split_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                0usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn hw_ip_checksum(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u16) }
     }
@@ -344,31 +265,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_ip_checksum_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 1usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_ip_checksum_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                1usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn hw_vlan_filter(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u16) }
     }
@@ -380,31 +276,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_vlan_filter_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 2usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_vlan_filter_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                2usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn hw_vlan_strip(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u16) }
     }
@@ -416,31 +287,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_vlan_strip_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 3usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_vlan_strip_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                3usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn hw_vlan_extend(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u16) }
     }
@@ -452,31 +298,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_vlan_extend_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 4usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_vlan_extend_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                4usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn jumbo_frame(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u16) }
     }
@@ -488,31 +309,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn jumbo_frame_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 5usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_jumbo_frame_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                5usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn hw_strip_crc(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u16) }
     }
@@ -524,31 +320,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_strip_crc_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 6usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_strip_crc_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                6usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn enable_scatter(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u16) }
     }
@@ -560,31 +331,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn enable_scatter_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 7usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_enable_scatter_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                7usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn enable_lro(&self) -> u16 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u16) }
     }
@@ -596,31 +342,6 @@ impl rte_eth_rxmode {
         }
     }
     #[inline]
-    pub unsafe fn enable_lro_raw(this: *const Self) -> u16 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 2usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 8usize, 1u8)
-                    as u16,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_enable_lro_raw(this: *mut Self, val: u16) {
-        unsafe {
-            let val: u16 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 2usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                8usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn new_bitfield_1(
         header_split: u16,
         hw_ip_checksum: u16,
@@ -808,30 +529,6 @@ impl rte_eth_txmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_vlan_reject_tagged_raw(this: *const Self) -> u8 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 1usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 0usize, 1u8) as u8,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_vlan_reject_tagged_raw(this: *mut Self, val: u8) {
-        unsafe {
-            let val: u8 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 1usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                0usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn hw_vlan_reject_untagged(&self) -> u8 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
     }
@@ -843,30 +540,6 @@ impl rte_eth_txmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_vlan_reject_untagged_raw(this: *const Self) -> u8 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 1usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 1usize, 1u8) as u8,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_vlan_reject_untagged_raw(this: *mut Self, val: u8) {
-        unsafe {
-            let val: u8 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 1usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                1usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn hw_vlan_insert_pvid(&self) -> u8 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
     }
@@ -878,30 +551,6 @@ impl rte_eth_txmode {
         }
     }
     #[inline]
-    pub unsafe fn hw_vlan_insert_pvid_raw(this: *const Self) -> u8 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 1usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 2usize, 1u8) as u8,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_hw_vlan_insert_pvid_raw(this: *mut Self, val: u8) {
-        unsafe {
-            let val: u8 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 1usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                2usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn new_bitfield_1(
         hw_vlan_reject_tagged: u8,
         hw_vlan_reject_untagged: u8,
diff --git a/bindgen-tests/tests/expectations/tests/layout_mbuf_1_0.rs b/bindgen-tests/tests/expectations/tests/layout_mbuf_1_0.rs
index db4f078a..38e221f3 100644
--- a/bindgen-tests/tests/expectations/tests/layout_mbuf_1_0.rs
+++ b/bindgen-tests/tests/expectations/tests/layout_mbuf_1_0.rs
@@ -32,14 +32,6 @@ where
         Self::extract_bit(byte, index)
     }
     #[inline]
-    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);
-        Self::extract_bit(byte, index)
-    }
-    #[inline]
     fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
         let bit_index = if cfg!(target_endian = "big") {
             7 - (index % 8)
@@ -57,14 +49,6 @@ where
         *byte = Self::change_bit(*byte, index, val);
     }
     #[inline]
-    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);
-    }
-    #[inline]
     pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -85,26 +69,6 @@ where
         val
     }
     #[inline]
-    pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        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) {
-                let index = if cfg!(target_endian = "big") {
-                    bit_width as usize - 1 - i
-                } else {
-                    i
-                };
-                val |= 1 << index;
-            }
-        }
-        val
-    }
-    #[inline]
     pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -122,24 +86,6 @@ where
             self.set_bit(index + bit_offset, val_bit_is_set);
         }
     }
-    #[inline]
-    pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        debug_assert!(
-            (bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>(),
-        );
-        for i in 0..(bit_width as usize) {
-            let mask = 1 << i;
-            let val_bit_is_set = val & mask == mask;
-            let index = if cfg!(target_endian = "big") {
-                bit_width as usize - 1 - i
-            } else {
-                i
-            };
-            Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
-        }
-    }
 }
 #[repr(C)]
 pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
@@ -360,31 +306,6 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn l2_type_raw(this: *const Self) -> u32 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 4usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 0usize, 4u8)
-                    as u32,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_l2_type_raw(this: *mut Self, val: u32) {
-        unsafe {
-            let val: u32 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 4usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                0usize,
-                4u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn l3_type(&self) -> u32 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u32) }
     }
@@ -396,31 +317,6 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn l3_type_raw(this: *const Self) -> u32 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 4usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 4usize, 4u8)
-                    as u32,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_l3_type_raw(this: *mut Self, val: u32) {
-        unsafe {
-            let val: u32 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 4usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                4usize,
-                4u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn l4_type(&self) -> u32 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 4u8) as u32) }
     }
@@ -432,31 +328,6 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn l4_type_raw(this: *const Self) -> u32 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 4usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 8usize, 4u8)
-                    as u32,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_l4_type_raw(this: *mut Self, val: u32) {
-        unsafe {
-            let val: u32 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 4usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                8usize,
-                4u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn tun_type(&self) -> u32 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 4u8) as u32) }
     }
@@ -468,31 +339,6 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn tun_type_raw(this: *const Self) -> u32 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 4usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 12usize, 4u8)
-                    as u32,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_tun_type_raw(this: *mut Self, val: u32) {
-        unsafe {
-            let val: u32 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 4usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                12usize,
-                4u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn inner_l2_type(&self) -> u32 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 4u8) as u32) }
     }
@@ -504,31 +350,6 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn inner_l2_type_raw(this: *const Self) -> u32 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 4usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 16usize, 4u8)
-                    as u32,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_inner_l2_type_raw(this: *mut Self, val: u32) {
-        unsafe {
-            let val: u32 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 4usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                16usize,
-                4u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn inner_l3_type(&self) -> u32 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(20usize, 4u8) as u32) }
     }
@@ -540,31 +361,6 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn inner_l3_type_raw(this: *const Self) -> u32 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 4usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 20usize, 4u8)
-                    as u32,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_inner_l3_type_raw(this: *mut Self, val: u32) {
-        unsafe {
-            let val: u32 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 4usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                20usize,
-                4u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn inner_l4_type(&self) -> u32 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 4u8) as u32) }
     }
@@ -576,31 +372,6 @@ impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn inner_l4_type_raw(this: *const Self) -> u32 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 4usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 24usize, 4u8)
-                    as u32,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_inner_l4_type_raw(this: *mut Self, val: u32) {
-        unsafe {
-            let val: u32 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 4usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                24usize,
-                4u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn new_bitfield_1(
         l2_type: u32,
         l3_type: u32,
@@ -991,31 +762,6 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn l2_len_raw(this: *const Self) -> u64 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 7usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 0usize, 7u8)
-                    as u64,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_l2_len_raw(this: *mut Self, val: u64) {
-        unsafe {
-            let val: u64 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 7usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                0usize,
-                7u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn l3_len(&self) -> u64 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 9u8) as u64) }
     }
@@ -1027,31 +773,6 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn l3_len_raw(this: *const Self) -> u64 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 7usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 7usize, 9u8)
-                    as u64,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_l3_len_raw(this: *mut Self, val: u64) {
-        unsafe {
-            let val: u64 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 7usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                7usize,
-                9u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn l4_len(&self) -> u64 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u64) }
     }
@@ -1063,31 +784,6 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn l4_len_raw(this: *const Self) -> u64 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 7usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 16usize, 8u8)
-                    as u64,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_l4_len_raw(this: *mut Self, val: u64) {
-        unsafe {
-            let val: u64 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 7usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                16usize,
-                8u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn tso_segsz(&self) -> u64 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 16u8) as u64) }
     }
@@ -1099,31 +795,6 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn tso_segsz_raw(this: *const Self) -> u64 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 7usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 24usize, 16u8)
-                    as u64,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_tso_segsz_raw(this: *mut Self, val: u64) {
-        unsafe {
-            let val: u64 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 7usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                24usize,
-                16u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn outer_l3_len(&self) -> u64 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(40usize, 9u8) as u64) }
     }
@@ -1135,31 +806,6 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn outer_l3_len_raw(this: *const Self) -> u64 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 7usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 40usize, 9u8)
-                    as u64,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_outer_l3_len_raw(this: *mut Self, val: u64) {
-        unsafe {
-            let val: u64 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 7usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                40usize,
-                9u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn outer_l2_len(&self) -> u64 {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(49usize, 7u8) as u64) }
     }
@@ -1171,31 +817,6 @@ impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn outer_l2_len_raw(this: *const Self) -> u64 {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 7usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 49usize, 7u8)
-                    as u64,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_outer_l2_len_raw(this: *mut Self, val: u64) {
-        unsafe {
-            let val: u64 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 7usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                49usize,
-                7u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn new_bitfield_1(
         l2_len: u64,
         l3_len: u64,
diff --git a/bindgen-tests/tests/expectations/tests/union_bitfield_1_0.rs b/bindgen-tests/tests/expectations/tests/union_bitfield_1_0.rs
index 9cf2bf8e..bd4a772c 100644
--- a/bindgen-tests/tests/expectations/tests/union_bitfield_1_0.rs
+++ b/bindgen-tests/tests/expectations/tests/union_bitfield_1_0.rs
@@ -32,14 +32,6 @@ where
         Self::extract_bit(byte, index)
     }
     #[inline]
-    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);
-        Self::extract_bit(byte, index)
-    }
-    #[inline]
     fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
         let bit_index = if cfg!(target_endian = "big") {
             7 - (index % 8)
@@ -57,14 +49,6 @@ where
         *byte = Self::change_bit(*byte, index, val);
     }
     #[inline]
-    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);
-    }
-    #[inline]
     pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -85,26 +69,6 @@ where
         val
     }
     #[inline]
-    pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        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) {
-                let index = if cfg!(target_endian = "big") {
-                    bit_width as usize - 1 - i
-                } else {
-                    i
-                };
-                val |= 1 << index;
-            }
-        }
-        val
-    }
-    #[inline]
     pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -122,24 +86,6 @@ where
             self.set_bit(index + bit_offset, val_bit_is_set);
         }
     }
-    #[inline]
-    pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        debug_assert!(
-            (bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>(),
-        );
-        for i in 0..(bit_width as usize) {
-            let mask = 1 << i;
-            let val_bit_is_set = val & mask == mask;
-            let index = if cfg!(target_endian = "big") {
-                bit_width as usize - 1 - i
-            } else {
-                i
-            };
-            Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
-        }
-    }
 }
 #[repr(C)]
 pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
@@ -216,34 +162,6 @@ impl U4 {
         }
     }
     #[inline]
-    pub unsafe fn derp_raw(this: *const Self) -> ::std::os::raw::c_uint {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 1usize],
-                >>::raw_get(
-                    (*::std::ptr::addr_of!((*this)._bitfield_1)).as_ref() as *const _,
-                    0usize,
-                    1u8,
-                ) as u32,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_derp_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
-        unsafe {
-            let val: u32 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 1usize],
-            >>::raw_set(
-                (*::std::ptr::addr_of_mut!((*this)._bitfield_1)).as_mut() as *mut _,
-                0usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn new_bitfield_1(
         derp: ::std::os::raw::c_uint,
     ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
@@ -292,34 +210,6 @@ impl B {
         }
     }
     #[inline]
-    pub unsafe fn foo_raw(this: *const Self) -> ::std::os::raw::c_uint {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 4usize],
-                >>::raw_get(
-                    (*::std::ptr::addr_of!((*this)._bitfield_1)).as_ref() as *const _,
-                    0usize,
-                    31u8,
-                ) as u32,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_foo_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
-        unsafe {
-            let val: u32 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 4usize],
-            >>::raw_set(
-                (*::std::ptr::addr_of_mut!((*this)._bitfield_1)).as_mut() as *mut _,
-                0usize,
-                31u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn bar(&self) -> ::std::os::raw::c_uchar {
         unsafe {
             ::std::mem::transmute(self._bitfield_1.as_ref().get(31usize, 1u8) as u8)
@@ -333,34 +223,6 @@ impl B {
         }
     }
     #[inline]
-    pub unsafe fn bar_raw(this: *const Self) -> ::std::os::raw::c_uchar {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 4usize],
-                >>::raw_get(
-                    (*::std::ptr::addr_of!((*this)._bitfield_1)).as_ref() as *const _,
-                    31usize,
-                    1u8,
-                ) as u8,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_bar_raw(this: *mut Self, val: ::std::os::raw::c_uchar) {
-        unsafe {
-            let val: u8 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 4usize],
-            >>::raw_set(
-                (*::std::ptr::addr_of_mut!((*this)._bitfield_1)).as_mut() as *mut _,
-                31usize,
-                1u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn new_bitfield_1(
         foo: ::std::os::raw::c_uint,
         bar: ::std::os::raw::c_uchar,
diff --git a/bindgen-tests/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs b/bindgen-tests/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs
index 287bfebf..ff19f398 100644
--- a/bindgen-tests/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs
+++ b/bindgen-tests/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs
@@ -32,14 +32,6 @@ where
         Self::extract_bit(byte, index)
     }
     #[inline]
-    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);
-        Self::extract_bit(byte, index)
-    }
-    #[inline]
     fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
         let bit_index = if cfg!(target_endian = "big") {
             7 - (index % 8)
@@ -57,14 +49,6 @@ where
         *byte = Self::change_bit(*byte, index, val);
     }
     #[inline]
-    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);
-    }
-    #[inline]
     pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -85,26 +69,6 @@ where
         val
     }
     #[inline]
-    pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        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) {
-                let index = if cfg!(target_endian = "big") {
-                    bit_width as usize - 1 - i
-                } else {
-                    i
-                };
-                val |= 1 << index;
-            }
-        }
-        val
-    }
-    #[inline]
     pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
         debug_assert!(bit_width <= 64);
         debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
@@ -122,24 +86,6 @@ where
             self.set_bit(index + bit_offset, val_bit_is_set);
         }
     }
-    #[inline]
-    pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
-        debug_assert!(bit_width <= 64);
-        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
-        debug_assert!(
-            (bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>(),
-        );
-        for i in 0..(bit_width as usize) {
-            let mask = 1 << i;
-            let val_bit_is_set = val & mask == mask;
-            let index = if cfg!(target_endian = "big") {
-                bit_width as usize - 1 - i
-            } else {
-                i
-            };
-            Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
-        }
-    }
 }
 #[repr(C)]
 pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
@@ -228,31 +174,6 @@ impl foo__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn b_raw(this: *const Self) -> ::std::os::raw::c_int {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 4usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 0usize, 7u8)
-                    as u32,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_b_raw(this: *mut Self, val: ::std::os::raw::c_int) {
-        unsafe {
-            let val: u32 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 4usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                0usize,
-                7u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn c(&self) -> ::std::os::raw::c_int {
         unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 25u8) as u32) }
     }
@@ -264,31 +185,6 @@ impl foo__bindgen_ty_1 {
         }
     }
     #[inline]
-    pub unsafe fn c_raw(this: *const Self) -> ::std::os::raw::c_int {
-        unsafe {
-            ::std::mem::transmute(
-                <__BindgenBitfieldUnit<
-                    [u8; 4usize],
-                >>::raw_get(::std::ptr::addr_of!((*this)._bitfield_1), 7usize, 25u8)
-                    as u32,
-            )
-        }
-    }
-    #[inline]
-    pub unsafe fn set_c_raw(this: *mut Self, val: ::std::os::raw::c_int) {
-        unsafe {
-            let val: u32 = ::std::mem::transmute(val);
-            <__BindgenBitfieldUnit<
-                [u8; 4usize],
-            >>::raw_set(
-                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
-                7usize,
-                25u8,
-                val as u64,
-            )
-        }
-    }
-    #[inline]
     pub fn new_bitfield_1(
         b: ::std::os::raw::c_int,
         c: ::std::os::raw::c_int,
diff --git a/bindgen-tests/tests/headers/derive-debug-bitfield-1-51.hpp b/bindgen-tests/tests/headers/derive-debug-bitfield-1-51.hpp
new file mode 100644
index 00000000..a68611d9
--- /dev/null
+++ b/bindgen-tests/tests/headers/derive-debug-bitfield-1-51.hpp
@@ -0,0 +1,7 @@
+// bindgen-flags: --impl-debug --rust-target 1.51
+
+class C {
+  bool a: 1;
+  bool b: 7;
+  int large_array[50];
+};