File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -1590,17 +1590,17 @@ impl MeshShaderPipelineStateStream {
1590
1590
( $subobject_type: expr, $data: expr) => { {
1591
1591
// Ensure 8-byte alignment for the subobject start
1592
1592
let alignment = 8 ;
1593
- let padding = ( alignment - ( bytes. len( ) % alignment) ) % alignment ;
1594
- bytes. extend ( core :: iter :: repeat ( 0 ) . take ( padding ) ) ;
1593
+ let aligned_length = bytes. len( ) . next_multiple_of ( alignment) ;
1594
+ bytes. resize ( aligned_length , 0 ) ;
1595
1595
1596
1596
// Append the type tag (u32)
1597
1597
let tag: u32 = $subobject_type. 0 as u32 ;
1598
1598
bytes. extend_from_slice( & tag. to_ne_bytes( ) ) ;
1599
1599
1600
1600
// Align the data
1601
1601
let obj_align = align_of_val( & $data) ;
1602
- let data_padding = ( obj_align - ( bytes. len( ) % obj_align) ) % obj_align ;
1603
- bytes. extend ( core :: iter :: repeat ( 0 ) . take ( data_padding ) ) ;
1602
+ let data_start = bytes. len( ) . next_multiple_of ( obj_align) ;
1603
+ bytes. resize ( data_start , 0 ) ;
1604
1604
1605
1605
// Append the data itself
1606
1606
#[ allow( clippy:: ptr_as_ptr, trivial_casts) ]
You can’t perform that action at this time.
0 commit comments