Skip to content

Commit

Permalink
Use split_first_chunk instead of splitting manually (#9273)
Browse files Browse the repository at this point in the history
Copyright (c) 2024, Arm Limited.

Signed-off-by: Karl Meakin <karl.meakin@arm.com>
  • Loading branch information
Kmeakin authored Sep 18, 2024
1 parent c74a7b7 commit c09b412
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pulley/src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ impl<'a> SafeBytecodeStream<'a> {

impl BytecodeStream for SafeBytecodeStream<'_> {
fn read<const N: usize>(&mut self) -> Result<[u8; N], Self::Error> {
let bytes = *self
let (bytes, rest) = self
.bytecode
.first_chunk::<N>()
.split_first_chunk()
.ok_or_else(|| self.unexpected_eof())?;
self.bytecode = &self.bytecode[N..];
self.bytecode = rest;
self.position += N;
Ok(bytes)
Ok(*bytes)
}

type Error = DecodingError;
Expand Down

0 comments on commit c09b412

Please sign in to comment.