mappings: pass a raw array for creating strides instead of a bigger, slower vec

This commit is contained in:
Victoria Fischer 2024-12-01 21:08:26 +01:00
parent d72f4c9a85
commit d23321d2ec

View File

@ -94,13 +94,13 @@ pub struct StrideMapping<const STRIDE_NUM: usize = 24> {
impl<const STRIDE_NUM: usize> StrideMapping<STRIDE_NUM> {
pub fn new() -> Self {
Self::from_json(vec!(
Self::from_json(&[
(0, 0, 255, false)
))
])
}
pub fn new_jar() -> Self {
Self::from_json(vec!(
Self::from_json(&[
(0, 0, 17, false),
(1, 0, 17, false),
(2, 0, 17, false),
@ -119,11 +119,11 @@ impl<const STRIDE_NUM: usize> StrideMapping<STRIDE_NUM> {
(15, 0, 17, false),
(16, 0, 17, false),
(17, 0, 17, false)
))
])
}
pub fn new_panel() -> Self {
Self::from_json(vec!(
Self::from_json(&[
(0, 0, 16, false),
(1, 0, 16, true),
(2, 0, 16, false),
@ -140,10 +140,10 @@ impl<const STRIDE_NUM: usize> StrideMapping<STRIDE_NUM> {
(13, 0, 16, true),
(14, 0, 16, false),
(15, 0, 16, true),
))
])
}
pub fn from_json(stride_json: Vec<(u8, u8, u8, bool)>) -> Self {
pub fn from_json(stride_json: &[(u8, u8, u8, bool)]) -> Self {
let mut strides = [Stride::default(); STRIDE_NUM];
let stride_count = stride_json.len();
let mut physical_idx = 0;