Skip to content

Commit

Permalink
patterns/jpeg: Simplify EOI marker search (#272)
Browse files Browse the repository at this point in the history
Co-authored-by: Nik <werwolv98@gmail.com>
  • Loading branch information
xndcn and WerWolv committed Jul 23, 2024
1 parent 5c7d77b commit 71e1ad8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions patterns/jpeg.hexpat
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,7 @@ fn sof0_component_read(SOF0Component c) {
};

fn get_eoi_marker_position() {
u32 pos = std::mem::find_sequence_in_range(0, $, std::mem::size(), 0xFF);
while (std::mem::read_unsigned(pos + 1, 1) != 0xD9) {
pos = std::mem::find_sequence_in_range(0, pos + 1, std::mem::size() + 1, 0xFF);
}
u32 pos = std::mem::find_sequence_in_range(0, $, std::mem::size(), 0xFF, 0xD9);
return pos;

};
Expand Down

0 comments on commit 71e1ad8

Please sign in to comment.