Skip to content

Commit

Permalink
cleanup align fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mschneider committed May 2, 2024
1 parent e666f5b commit 0142fdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/anchor
Submodule anchor updated 302 files
6 changes: 3 additions & 3 deletions programs/openbook-v2/src/state/orderbook/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,12 @@ impl LeafNode {

#[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
#[repr(C)]
#[repr(align(8))]
pub struct FreeNode {
pub(crate) tag: u8, // NodeTag
pub(crate) padding: [u8; 3],
pub(crate) next: NodeHandle,
pub(crate) reserved: [u8; NODE_SIZE - 16],
// essential to make AnyNode alignment the same as other node types
pub(crate) force_align: u64,
pub(crate) reserved: [u8; NODE_SIZE - 8],
}
const_assert_eq!(size_of::<FreeNode>(), NODE_SIZE);
const_assert_eq!(size_of::<FreeNode>() % 8, 0);
Expand All @@ -254,6 +253,7 @@ pub struct AnyNode {
pub tag: u8,
pub data: [u8; 79],
// essential to make AnyNode alignment the same as other node types
// should prefer repr(align(8)), but that's not compatible with anchor's zero_copy attribute
pub force_align: u64,
}
const_assert_eq!(size_of::<AnyNode>(), NODE_SIZE);
Expand Down

0 comments on commit 0142fdd

Please sign in to comment.