File tree Expand file tree Collapse file tree 4 files changed +4
-4
lines changed Expand file tree Collapse file tree 4 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ pub(crate) struct Account {
6363 /// - `7 6 5 4 3 2 1 0`
6464 /// - `. x x x . . . .`: number of immutable borrows that can still be
6565 /// allocated, for the lamports field. Ranges from 7 (`111`) to
66- /// 0 (`000`).
66+ /// 0 (`000`).
6767 ///
6868 /// * data mutable borrow flag
6969 /// - `7 6 5 4 3 2 1 0`
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ macro_rules! align_pointer {
197197 ( $ptr: ident) => {
198198 // integer-to-pointer cast: the resulting pointer will have the same provenance as
199199 // the original pointer and it follows the alignment requirement for the input.
200- ( ( $ptr as usize + ( BPF_ALIGN_OF_U128 - 1 ) ) & !( BPF_ALIGN_OF_U128 - 1 ) ) as * mut u8
200+ $ptr . with_addr ( ( ( $ptr. addr ( ) + ( BPF_ALIGN_OF_U128 - 1 ) ) & !( BPF_ALIGN_OF_U128 - 1 ) ) )
201201 } ;
202202}
203203
Original file line number Diff line number Diff line change @@ -416,7 +416,7 @@ fn test_from_account_info_constructor() {
416416 unsafe {
417417 let header_size = core:: mem:: size_of :: < AccountLayout > ( ) ;
418418 let total_size = header_size + data. len ( ) ;
419- let word_len = ( total_size + 7 ) / 8 ;
419+ let word_len = total_size. div_ceil ( 8 ) ;
420420 aligned_backing = std:: vec![ 0u64 ; word_len] ;
421421 let base_ptr = aligned_backing. as_mut_ptr ( ) as * mut u8 ;
422422
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ pub unsafe fn make_account_info(
123123) -> ( AccountInfo , Vec < u64 > ) {
124124 let hdr_size = mem:: size_of :: < AccountLayout > ( ) ;
125125 let total = hdr_size + data. len ( ) ;
126- let words = ( total + 7 ) / 8 ;
126+ let words = total. div_ceil ( 8 ) ;
127127 let mut backing: Vec < u64 > = std:: vec![ 0u64 ; words] ;
128128 assert ! (
129129 mem:: align_of:: <u64 >( ) >= mem:: align_of:: <AccountLayout >( ) ,
You can’t perform that action at this time.
0 commit comments