Skip to content

Commit 6df0dd2

Browse files
committed
f use align() rather than repr(C), because we don't care about order
1 parent 231a5e7 commit 6df0dd2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lightning/src/routing/router.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ impl_writeable_tlv_based!(RouteHintHop, {
967967
});
968968

969969
#[derive(Eq, PartialEq)]
970-
#[repr(C)] // Force our field ordering to keep the size 64 bytes
970+
#[repr(align(64))] // Force the size to 64 bytes
971971
struct RouteGraphNode {
972972
node_id: NodeId,
973973
score: u64,
@@ -994,7 +994,7 @@ impl cmp::PartialOrd for RouteGraphNode {
994994
}
995995
}
996996

997-
// While RouteGraphNode can be laid out as 56 bytes, performance appears to be improved
997+
// While RouteGraphNode can be laid out with fewer bytes, performance appears to be improved
998998
// substantially when it is laid out at exactly 64 bytes.
999999
//
10001000
// Thus, we use `#[repr(C)]` on the struct to force a suboptimal layout and check that it stays 64

0 commit comments

Comments
 (0)