From 0cd469866ca42c26d3d6f16a2ca3ee0f17945d7b Mon Sep 17 00:00:00 2001 From: Corwin Date: Tue, 4 Jul 2023 21:35:00 +0100 Subject: [PATCH] font get optimisation --- agb/src/display/font.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agb/src/display/font.rs b/agb/src/display/font.rs index 17bd184a..e37a77a2 100644 --- a/agb/src/display/font.rs +++ b/agb/src/display/font.rs @@ -47,14 +47,14 @@ impl FontLetter { } pub struct Font { - letters: &'static [FontLetter], + letters: &'static [FontLetter; 128], line_height: i32, ascent: i32, } impl Font { #[must_use] - pub const fn new(letters: &'static [FontLetter], line_height: i32, ascent: i32) -> Self { + pub const fn new(letters: &'static [FontLetter; 128], line_height: i32, ascent: i32) -> Self { Self { letters, line_height, @@ -63,7 +63,7 @@ impl Font { } pub(crate) fn letter(&self, letter: char) -> &'static FontLetter { - &self.letters[letter as usize] + &self.letters[letter as usize & (128 - 1)] } pub(crate) fn ascent(&self) -> i32 {