Skip to content

Commit

Permalink
Fix: Use correct pointer for align_offset call
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-opp committed Aug 8, 2024
1 parent 350f15f commit b20cef6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libraries/shared-memory-server/src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ fn offsets(

fn offset_ptrs(next_free: *mut u8) -> (*mut AtomicBool, *mut AtomicU64, *mut u8) {
let disconnect_ptr = next_free.wrapping_add(next_free.align_offset(align_of::<AtomicBool>()));
let len_ptr = disconnect_ptr
.wrapping_add(mem::size_of::<AtomicBool>())
.wrapping_add(next_free.align_offset(align_of::<AtomicU64>()));
let len_ptr_unaligned = disconnect_ptr.wrapping_add(mem::size_of::<AtomicBool>());
let len_ptr =
len_ptr_unaligned.wrapping_add(len_ptr_unaligned.align_offset(align_of::<AtomicU64>()));
let data_ptr = len_ptr.wrapping_add(mem::size_of::<AtomicU64>());
(disconnect_ptr.cast(), len_ptr.cast(), data_ptr)
}
Expand Down

0 comments on commit b20cef6

Please sign in to comment.