90
90
}
91
91
}
92
92
#[ repr( C ) ]
93
+ #[ repr( align( 16 ) ) ]
93
94
#[ derive( Debug , Default , Copy , Clone ) ]
94
95
pub struct HasBigBitfield {
95
96
pub _bitfield_1 : __BindgenBitfieldUnit < [ u8 ; 16usize ] , u64 > ,
@@ -101,8 +102,37 @@ fn bindgen_test_layout_HasBigBitfield() {
101
102
16usize ,
102
103
concat!( "Size of: " , stringify!( HasBigBitfield ) )
103
104
) ;
105
+ assert_eq ! (
106
+ :: std:: mem:: align_of:: <HasBigBitfield >( ) ,
107
+ 16usize ,
108
+ concat!( "Alignment of " , stringify!( HasBigBitfield ) )
109
+ ) ;
110
+ }
111
+ impl HasBigBitfield {
112
+ #[ inline]
113
+ pub fn x ( & self ) -> i128 {
114
+ unsafe { :: std:: mem:: transmute ( self . _bitfield_1 . get ( 0usize , 128u8 ) as u128 ) }
115
+ }
116
+ #[ inline]
117
+ pub fn set_x ( & mut self , val : i128 ) {
118
+ unsafe {
119
+ let val: u128 = :: std:: mem:: transmute ( val) ;
120
+ self . _bitfield_1 . set ( 0usize , 128u8 , val as u64 )
121
+ }
122
+ }
123
+ #[ inline]
124
+ pub fn new_bitfield_1 ( x : i128 ) -> __BindgenBitfieldUnit < [ u8 ; 16usize ] , u64 > {
125
+ let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit < [ u8 ; 16usize ] , u64 > =
126
+ Default :: default ( ) ;
127
+ __bindgen_bitfield_unit. set ( 0usize , 128u8 , {
128
+ let x: u128 = unsafe { :: std:: mem:: transmute ( x) } ;
129
+ x as u64
130
+ } ) ;
131
+ __bindgen_bitfield_unit
132
+ }
104
133
}
105
134
#[ repr( C ) ]
135
+ #[ repr( align( 16 ) ) ]
106
136
#[ derive( Debug , Default , Copy , Clone ) ]
107
137
pub struct HasTwoBigBitfields {
108
138
pub _bitfield_1 : __BindgenBitfieldUnit < [ u8 ; 16usize ] , u64 > ,
@@ -114,4 +144,47 @@ fn bindgen_test_layout_HasTwoBigBitfields() {
114
144
16usize ,
115
145
concat!( "Size of: " , stringify!( HasTwoBigBitfields ) )
116
146
) ;
147
+ assert_eq ! (
148
+ :: std:: mem:: align_of:: <HasTwoBigBitfields >( ) ,
149
+ 16usize ,
150
+ concat!( "Alignment of " , stringify!( HasTwoBigBitfields ) )
151
+ ) ;
152
+ }
153
+ impl HasTwoBigBitfields {
154
+ #[ inline]
155
+ pub fn x ( & self ) -> i128 {
156
+ unsafe { :: std:: mem:: transmute ( self . _bitfield_1 . get ( 0usize , 80u8 ) as u128 ) }
157
+ }
158
+ #[ inline]
159
+ pub fn set_x ( & mut self , val : i128 ) {
160
+ unsafe {
161
+ let val: u128 = :: std:: mem:: transmute ( val) ;
162
+ self . _bitfield_1 . set ( 0usize , 80u8 , val as u64 )
163
+ }
164
+ }
165
+ #[ inline]
166
+ pub fn y ( & self ) -> i128 {
167
+ unsafe { :: std:: mem:: transmute ( self . _bitfield_1 . get ( 80usize , 48u8 ) as u128 ) }
168
+ }
169
+ #[ inline]
170
+ pub fn set_y ( & mut self , val : i128 ) {
171
+ unsafe {
172
+ let val: u128 = :: std:: mem:: transmute ( val) ;
173
+ self . _bitfield_1 . set ( 80usize , 48u8 , val as u64 )
174
+ }
175
+ }
176
+ #[ inline]
177
+ pub fn new_bitfield_1 ( x : i128 , y : i128 ) -> __BindgenBitfieldUnit < [ u8 ; 16usize ] , u64 > {
178
+ let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit < [ u8 ; 16usize ] , u64 > =
179
+ Default :: default ( ) ;
180
+ __bindgen_bitfield_unit. set ( 0usize , 80u8 , {
181
+ let x: u128 = unsafe { :: std:: mem:: transmute ( x) } ;
182
+ x as u64
183
+ } ) ;
184
+ __bindgen_bitfield_unit. set ( 80usize , 48u8 , {
185
+ let y: u128 = unsafe { :: std:: mem:: transmute ( y) } ;
186
+ y as u64
187
+ } ) ;
188
+ __bindgen_bitfield_unit
189
+ }
117
190
}
0 commit comments