Skip to content

Commit 954f156

Browse files
committed
entrypoint: remove unnecessary deser case
1 parent 08adc6b commit 954f156

File tree

1 file changed

+24
-28
lines changed
  • sdk/pinocchio/src/entrypoint

1 file changed

+24
-28
lines changed

sdk/pinocchio/src/entrypoint/mod.rs

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -353,35 +353,31 @@ pub unsafe fn deserialize<const MAX_ACCOUNTS: usize>(
353353
// This is an optimization to reduce the number of jumps required to process the
354354
// accounts. The macro `process_accounts` will generate inline code to process the
355355
// specified number of accounts.
356-
if to_process_plus_one == 2 {
357-
process_accounts!(1 => (input, accounts, accounts_slice));
358-
} else {
359-
while to_process_plus_one > 5 {
360-
// Process 5 accounts at a time.
361-
process_accounts!(5 => (input, accounts, accounts_slice));
362-
to_process_plus_one -= 5;
363-
}
356+
while to_process_plus_one > 5 {
357+
// Process 5 accounts at a time.
358+
process_accounts!(5 => (input, accounts, accounts_slice));
359+
to_process_plus_one -= 5;
360+
}
364361

365-
// There might be remaining accounts to process.
366-
match to_process_plus_one {
367-
5 => {
368-
process_accounts!(4 => (input, accounts, accounts_slice));
369-
}
370-
4 => {
371-
process_accounts!(3 => (input, accounts, accounts_slice));
372-
}
373-
3 => {
374-
process_accounts!(2 => (input, accounts, accounts_slice));
375-
}
376-
2 => {
377-
process_accounts!(1 => (input, accounts, accounts_slice));
378-
}
379-
1 => (),
380-
_ => {
381-
// SAFETY: `while` loop above makes sure that `to_process_plus_one`
382-
// has 1 to 5 entries left.
383-
unsafe { core::hint::unreachable_unchecked() }
384-
}
362+
// There might be remaining accounts to process.
363+
match to_process_plus_one {
364+
5 => {
365+
process_accounts!(4 => (input, accounts, accounts_slice));
366+
}
367+
4 => {
368+
process_accounts!(3 => (input, accounts, accounts_slice));
369+
}
370+
3 => {
371+
process_accounts!(2 => (input, accounts, accounts_slice));
372+
}
373+
2 => {
374+
process_accounts!(1 => (input, accounts, accounts_slice));
375+
}
376+
1 => (),
377+
_ => {
378+
// SAFETY: `while` loop above makes sure that `to_process_plus_one`
379+
// has 1 to 5 entries left.
380+
unsafe { core::hint::unreachable_unchecked() }
385381
}
386382
}
387383

0 commit comments

Comments
 (0)