From a111a41deb9c71aed27d69f7c0fb37e4acb12980 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Thu, 6 Apr 2023 21:55:11 +0100 Subject: [PATCH] Extract constant --- agb-gbafix/src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/agb-gbafix/src/main.rs b/agb-gbafix/src/main.rs index 039c1896..88747d80 100644 --- a/agb-gbafix/src/main.rs +++ b/agb-gbafix/src/main.rs @@ -37,8 +37,10 @@ fn main() -> Result<(), Box> { } if !written_header { + const GBA_HEADER_SIZE: usize = 192; + assert!( - data.len() > 192, + data.len() > GBA_HEADER_SIZE, "first section must be at least as big as the gba header" ); @@ -48,7 +50,7 @@ fn main() -> Result<(), Box> { let header_bytes = bytemuck::bytes_of(&header); output.write_all(header_bytes)?; - data = &data[192..]; + data = &data[GBA_HEADER_SIZE..]; written_header = true; }