1- /* automatically generated by rust-bindgen 0.70 .1 */
1+ /* automatically generated by rust-bindgen 0.71 .1 */
22
33pub type __s8 = crate :: ctypes:: c_schar ;
44pub type __u8 = crate :: ctypes:: c_uchar ;
@@ -2896,26 +2896,48 @@ where
28962896Storage : AsRef < [ u8 ] > + AsMut < [ u8 ] > ,
28972897{
28982898#[ inline]
2899+ fn extract_bit ( byte : u8 , index : usize ) -> bool {
2900+ let bit_index = if cfg ! ( target_endian = "big" ) { 7 - ( index % 8 ) } else { index % 8 } ;
2901+ let mask = 1 << bit_index;
2902+ byte & mask == mask
2903+ }
2904+ #[ inline]
28992905pub fn get_bit ( & self , index : usize ) -> bool {
29002906debug_assert ! ( index / 8 < self . storage. as_ref( ) . len( ) ) ;
29012907let byte_index = index / 8 ;
29022908let byte = self . storage . as_ref ( ) [ byte_index] ;
2909+ Self :: extract_bit ( byte, index)
2910+ }
2911+ #[ inline]
2912+ pub unsafe fn raw_get_bit ( this : * const Self , index : usize ) -> bool {
2913+ debug_assert ! ( index / 8 < core:: mem:: size_of:: <Storage >( ) ) ;
2914+ let byte_index = index / 8 ;
2915+ let byte = * ( core:: ptr:: addr_of!( ( * this) . storage) as * const u8 ) . offset ( byte_index as isize ) ;
2916+ Self :: extract_bit ( byte, index)
2917+ }
2918+ #[ inline]
2919+ fn change_bit ( byte : u8 , index : usize , val : bool ) -> u8 {
29032920let bit_index = if cfg ! ( target_endian = "big" ) { 7 - ( index % 8 ) } else { index % 8 } ;
29042921let mask = 1 << bit_index;
2905- byte & mask == mask
2922+ if val {
2923+ byte | mask
2924+ } else {
2925+ byte & !mask
2926+ }
29062927}
29072928#[ inline]
29082929pub fn set_bit ( & mut self , index : usize , val : bool ) {
29092930debug_assert ! ( index / 8 < self . storage. as_ref( ) . len( ) ) ;
29102931let byte_index = index / 8 ;
29112932let byte = & mut self . storage . as_mut ( ) [ byte_index] ;
2912- let bit_index = if cfg ! ( target_endian = "big" ) { 7 - ( index % 8 ) } else { index % 8 } ;
2913- let mask = 1 << bit_index;
2914- if val {
2915- * byte |= mask;
2916- } else {
2917- * byte &= !mask;
2933+ * byte = Self :: change_bit ( * byte, index, val) ;
29182934}
2935+ #[ inline]
2936+ pub unsafe fn raw_set_bit ( this : * mut Self , index : usize , val : bool ) {
2937+ debug_assert ! ( index / 8 < core:: mem:: size_of:: <Storage >( ) ) ;
2938+ let byte_index = index / 8 ;
2939+ let byte = ( core:: ptr:: addr_of_mut!( ( * this) . storage) as * mut u8 ) . offset ( byte_index as isize ) ;
2940+ * byte = Self :: change_bit ( * byte, index, val) ;
29192941}
29202942#[ inline]
29212943pub fn get ( & self , bit_offset : usize , bit_width : u8 ) -> u64 {
@@ -2932,6 +2954,20 @@ val |= 1 << index;
29322954val
29332955}
29342956#[ inline]
2957+ pub unsafe fn raw_get ( this : * const Self , bit_offset : usize , bit_width : u8 ) -> u64 {
2958+ debug_assert ! ( bit_width <= 64 ) ;
2959+ debug_assert ! ( bit_offset / 8 < core:: mem:: size_of:: <Storage >( ) ) ;
2960+ debug_assert ! ( ( bit_offset + ( bit_width as usize ) ) / 8 <= core:: mem:: size_of:: <Storage >( ) ) ;
2961+ let mut val = 0 ;
2962+ for i in 0 ..( bit_width as usize ) {
2963+ if Self :: raw_get_bit ( this, i + bit_offset) {
2964+ let index = if cfg ! ( target_endian = "big" ) { bit_width as usize - 1 - i } else { i } ;
2965+ val |= 1 << index;
2966+ }
2967+ }
2968+ val
2969+ }
2970+ #[ inline]
29352971pub fn set ( & mut self , bit_offset : usize , bit_width : u8 , val : u64 ) {
29362972debug_assert ! ( bit_width <= 64 ) ;
29372973debug_assert ! ( bit_offset / 8 < self . storage. as_ref( ) . len( ) ) ;
@@ -2943,6 +2979,18 @@ let index = if cfg!(target_endian = "big") { bit_width as usize - 1 - i } else {
29432979self . set_bit ( index + bit_offset, val_bit_is_set) ;
29442980}
29452981}
2982+ #[ inline]
2983+ pub unsafe fn raw_set ( this : * mut Self , bit_offset : usize , bit_width : u8 , val : u64 ) {
2984+ debug_assert ! ( bit_width <= 64 ) ;
2985+ debug_assert ! ( bit_offset / 8 < core:: mem:: size_of:: <Storage >( ) ) ;
2986+ debug_assert ! ( ( bit_offset + ( bit_width as usize ) ) / 8 <= core:: mem:: size_of:: <Storage >( ) ) ;
2987+ for i in 0 ..( bit_width as usize ) {
2988+ let mask = 1 << i;
2989+ let val_bit_is_set = val & mask == mask;
2990+ let index = if cfg ! ( target_endian = "big" ) { bit_width as usize - 1 - i } else { i } ;
2991+ Self :: raw_set_bit ( this, index + bit_offset, val_bit_is_set) ;
2992+ }
2993+ }
29462994}
29472995impl < T > __IncompleteArrayField < T > {
29482996#[ inline]
@@ -2987,6 +3035,17 @@ self._bitfield_1.set(0usize, 1u8, val as u64)
29873035}
29883036}
29893037#[ inline]
3038+ pub unsafe fn seg_32bit_raw ( this : * const Self ) -> crate :: ctypes:: c_uint {
3039+ unsafe { :: core:: mem:: transmute ( <__BindgenBitfieldUnit < [ u8 ; 1usize ] > >:: raw_get ( :: core:: ptr:: addr_of!( ( * this) . _bitfield_1) , 0usize , 1u8 ) as u32 ) }
3040+ }
3041+ #[ inline]
3042+ pub unsafe fn set_seg_32bit_raw ( this : * mut Self , val : crate :: ctypes:: c_uint ) {
3043+ unsafe {
3044+ let val: u32 = :: core:: mem:: transmute ( val) ;
3045+ <__BindgenBitfieldUnit < [ u8 ; 1usize ] > >:: raw_set ( :: core:: ptr:: addr_of_mut!( ( * this) . _bitfield_1) , 0usize , 1u8 , val as u64 )
3046+ }
3047+ }
3048+ #[ inline]
29903049pub fn contents ( & self ) -> crate :: ctypes:: c_uint {
29913050unsafe { :: core:: mem:: transmute ( self . _bitfield_1 . get ( 1usize , 2u8 ) as u32 ) }
29923051}
@@ -2998,6 +3057,17 @@ self._bitfield_1.set(1usize, 2u8, val as u64)
29983057}
29993058}
30003059#[ inline]
3060+ pub unsafe fn contents_raw ( this : * const Self ) -> crate :: ctypes:: c_uint {
3061+ unsafe { :: core:: mem:: transmute ( <__BindgenBitfieldUnit < [ u8 ; 1usize ] > >:: raw_get ( :: core:: ptr:: addr_of!( ( * this) . _bitfield_1) , 1usize , 2u8 ) as u32 ) }
3062+ }
3063+ #[ inline]
3064+ pub unsafe fn set_contents_raw ( this : * mut Self , val : crate :: ctypes:: c_uint ) {
3065+ unsafe {
3066+ let val: u32 = :: core:: mem:: transmute ( val) ;
3067+ <__BindgenBitfieldUnit < [ u8 ; 1usize ] > >:: raw_set ( :: core:: ptr:: addr_of_mut!( ( * this) . _bitfield_1) , 1usize , 2u8 , val as u64 )
3068+ }
3069+ }
3070+ #[ inline]
30013071pub fn read_exec_only ( & self ) -> crate :: ctypes:: c_uint {
30023072unsafe { :: core:: mem:: transmute ( self . _bitfield_1 . get ( 3usize , 1u8 ) as u32 ) }
30033073}
@@ -3009,6 +3079,17 @@ self._bitfield_1.set(3usize, 1u8, val as u64)
30093079}
30103080}
30113081#[ inline]
3082+ pub unsafe fn read_exec_only_raw ( this : * const Self ) -> crate :: ctypes:: c_uint {
3083+ unsafe { :: core:: mem:: transmute ( <__BindgenBitfieldUnit < [ u8 ; 1usize ] > >:: raw_get ( :: core:: ptr:: addr_of!( ( * this) . _bitfield_1) , 3usize , 1u8 ) as u32 ) }
3084+ }
3085+ #[ inline]
3086+ pub unsafe fn set_read_exec_only_raw ( this : * mut Self , val : crate :: ctypes:: c_uint ) {
3087+ unsafe {
3088+ let val: u32 = :: core:: mem:: transmute ( val) ;
3089+ <__BindgenBitfieldUnit < [ u8 ; 1usize ] > >:: raw_set ( :: core:: ptr:: addr_of_mut!( ( * this) . _bitfield_1) , 3usize , 1u8 , val as u64 )
3090+ }
3091+ }
3092+ #[ inline]
30123093pub fn limit_in_pages ( & self ) -> crate :: ctypes:: c_uint {
30133094unsafe { :: core:: mem:: transmute ( self . _bitfield_1 . get ( 4usize , 1u8 ) as u32 ) }
30143095}
@@ -3020,6 +3101,17 @@ self._bitfield_1.set(4usize, 1u8, val as u64)
30203101}
30213102}
30223103#[ inline]
3104+ pub unsafe fn limit_in_pages_raw ( this : * const Self ) -> crate :: ctypes:: c_uint {
3105+ unsafe { :: core:: mem:: transmute ( <__BindgenBitfieldUnit < [ u8 ; 1usize ] > >:: raw_get ( :: core:: ptr:: addr_of!( ( * this) . _bitfield_1) , 4usize , 1u8 ) as u32 ) }
3106+ }
3107+ #[ inline]
3108+ pub unsafe fn set_limit_in_pages_raw ( this : * mut Self , val : crate :: ctypes:: c_uint ) {
3109+ unsafe {
3110+ let val: u32 = :: core:: mem:: transmute ( val) ;
3111+ <__BindgenBitfieldUnit < [ u8 ; 1usize ] > >:: raw_set ( :: core:: ptr:: addr_of_mut!( ( * this) . _bitfield_1) , 4usize , 1u8 , val as u64 )
3112+ }
3113+ }
3114+ #[ inline]
30233115pub fn seg_not_present ( & self ) -> crate :: ctypes:: c_uint {
30243116unsafe { :: core:: mem:: transmute ( self . _bitfield_1 . get ( 5usize , 1u8 ) as u32 ) }
30253117}
@@ -3031,6 +3123,17 @@ self._bitfield_1.set(5usize, 1u8, val as u64)
30313123}
30323124}
30333125#[ inline]
3126+ pub unsafe fn seg_not_present_raw ( this : * const Self ) -> crate :: ctypes:: c_uint {
3127+ unsafe { :: core:: mem:: transmute ( <__BindgenBitfieldUnit < [ u8 ; 1usize ] > >:: raw_get ( :: core:: ptr:: addr_of!( ( * this) . _bitfield_1) , 5usize , 1u8 ) as u32 ) }
3128+ }
3129+ #[ inline]
3130+ pub unsafe fn set_seg_not_present_raw ( this : * mut Self , val : crate :: ctypes:: c_uint ) {
3131+ unsafe {
3132+ let val: u32 = :: core:: mem:: transmute ( val) ;
3133+ <__BindgenBitfieldUnit < [ u8 ; 1usize ] > >:: raw_set ( :: core:: ptr:: addr_of_mut!( ( * this) . _bitfield_1) , 5usize , 1u8 , val as u64 )
3134+ }
3135+ }
3136+ #[ inline]
30343137pub fn useable ( & self ) -> crate :: ctypes:: c_uint {
30353138unsafe { :: core:: mem:: transmute ( self . _bitfield_1 . get ( 6usize , 1u8 ) as u32 ) }
30363139}
@@ -3042,6 +3145,17 @@ self._bitfield_1.set(6usize, 1u8, val as u64)
30423145}
30433146}
30443147#[ inline]
3148+ pub unsafe fn useable_raw ( this : * const Self ) -> crate :: ctypes:: c_uint {
3149+ unsafe { :: core:: mem:: transmute ( <__BindgenBitfieldUnit < [ u8 ; 1usize ] > >:: raw_get ( :: core:: ptr:: addr_of!( ( * this) . _bitfield_1) , 6usize , 1u8 ) as u32 ) }
3150+ }
3151+ #[ inline]
3152+ pub unsafe fn set_useable_raw ( this : * mut Self , val : crate :: ctypes:: c_uint ) {
3153+ unsafe {
3154+ let val: u32 = :: core:: mem:: transmute ( val) ;
3155+ <__BindgenBitfieldUnit < [ u8 ; 1usize ] > >:: raw_set ( :: core:: ptr:: addr_of_mut!( ( * this) . _bitfield_1) , 6usize , 1u8 , val as u64 )
3156+ }
3157+ }
3158+ #[ inline]
30453159pub fn new_bitfield_1 ( seg_32bit : crate :: ctypes:: c_uint , contents : crate :: ctypes:: c_uint , read_exec_only : crate :: ctypes:: c_uint , limit_in_pages : crate :: ctypes:: c_uint , seg_not_present : crate :: ctypes:: c_uint , useable : crate :: ctypes:: c_uint ) -> __BindgenBitfieldUnit < [ u8 ; 1usize ] > {
30463160let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit < [ u8 ; 1usize ] > = Default :: default ( ) ;
30473161__bindgen_bitfield_unit. set ( 0usize , 1u8 , {
0 commit comments