Skip to content

Commit df9665e

Browse files
committed
entrypoint: remove unnecessary deser case
1 parent 2ad5a54 commit df9665e

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
@@ -352,35 +352,31 @@ pub unsafe fn deserialize<const MAX_ACCOUNTS: usize>(
352352
// This is an optimization to reduce the number of jumps required
353353
// to process the accounts. The macro `process_accounts` will generate
354354
// inline code to process the specified number of accounts.
355-
if to_process_plus_one == 2 {
356-
process_accounts!(1 => (input, accounts, accounts_slice));
357-
} else {
358-
while to_process_plus_one > 5 {
359-
// Process 5 accounts at a time.
360-
process_accounts!(5 => (input, accounts, accounts_slice));
361-
to_process_plus_one -= 5;
362-
}
355+
while to_process_plus_one > 5 {
356+
// Process 5 accounts at a time.
357+
process_accounts!(5 => (input, accounts, accounts_slice));
358+
to_process_plus_one -= 5;
359+
}
363360

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

0 commit comments

Comments
 (0)