SPEEEEEEDDDD
This commit is contained in:
parent
c1e907dbcd
commit
f7bbc22c6a
|
@ -3,5 +3,6 @@ rustflags = [
|
|||
"-C", "link-args=-fuse-ld=lld",
|
||||
"-C", "opt-level=3", # I don't think this is useful in release mode, but lets keep it anyways for the placebo
|
||||
"-C", "target-cpu=native",
|
||||
"-Clink-arg=-Wl,--no-rosegment"
|
||||
]
|
||||
|
||||
|
|
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -133,9 +133,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.113"
|
||||
version = "0.2.117"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eef78b64d87775463c549fbd80e19249ef436ea3bf1de2a1eb7e717ec7fab1e9"
|
||||
checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
|
|
|
@ -11,6 +11,7 @@ use std::{env, io, process};
|
|||
use thiserror::Error;
|
||||
|
||||
mod nummap;
|
||||
mod nummatch;
|
||||
mod unsafe_std;
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -116,6 +117,7 @@ fn unfuck_cif_number(number: &str) -> Result<u32> {
|
|||
if i > 0 {
|
||||
join_to_arraystring(&split[..i], &mut buf)?;
|
||||
nummap::U16_NUMMAP.get(&buf).ok_or_else(|| GrammarError(number.to_string()))?
|
||||
//nummatch::u_16(&buf)?
|
||||
} else {
|
||||
return Err(GrammarError(number.to_string()))
|
||||
}
|
||||
|
@ -126,12 +128,13 @@ fn unfuck_cif_number(number: &str) -> Result<u32> {
|
|||
buf.clear();
|
||||
join_to_arraystring(&split[i + 1..], &mut buf)?;
|
||||
nummap::U16_NUMMAP.get(&buf).ok_or_else(|| GrammarError(number.to_string()))?
|
||||
//nummatch::u_16(&buf)?
|
||||
} else {
|
||||
&0_u16
|
||||
};
|
||||
return Ok(u32::from(*thousands) * 1000 + u32::from(*remainder))
|
||||
}
|
||||
Ok((*nummap::U16_NUMMAP.get(number).ok_or_else(|| GrammarError(number.to_string()))?).into())
|
||||
Ok((*nummap::U16_NUMMAP.get(&buf).ok_or_else(|| GrammarError(number.to_string()))?).into())
|
||||
}
|
||||
|
||||
fn unfuck_cif_number_fast(number: &str) -> Result<u8> {
|
||||
|
@ -141,6 +144,7 @@ fn unfuck_cif_number_fast(number: &str) -> Result<u8> {
|
|||
|
||||
join_to_arraystring(&split, &mut buf)?;
|
||||
let number = *(nummap::U8_NUMMAP.get(&buf).ok_or_else(|| InvalidPixelError(number.to_string()))?);
|
||||
//let number = nummatch::u_8(&buf)?;
|
||||
|
||||
Ok(number)
|
||||
}
|
||||
|
@ -151,7 +155,8 @@ fn unfuck_color_type(color_type: &str) -> Result<ColorType> {
|
|||
let split = color_type.split_ascii_whitespace().take(8).collect::<ArrayVec<_, 2>>();
|
||||
|
||||
join_to_arraystring(&split, &mut buf)?;
|
||||
let color_type = *(nummap::COLOR_TYPE_NUMMAP.get(&buf).ok_or_else(|| InvalidSizeError(color_type.to_string()))?);
|
||||
//let color_type = *(nummap::COLOR_TYPE_NUMMAP.get(&buf).ok_or_else(|| InvalidSizeError(color_type.to_string()))?);
|
||||
let color_type = nummatch::color_type(&buf)?;
|
||||
|
||||
Ok(color_type)
|
||||
}
|
||||
|
|
|
@ -1262,7 +1262,7 @@ pub static U8_NUMMAP: Map<&'static str, u8> = phf_map! {
|
|||
"dwieście pięćdziesiąt pięć" => 255,
|
||||
};
|
||||
|
||||
pub static COLOR_TYPE_NUMMAP: Map<&'static str, png::ColorType> = phf_map! {
|
||||
/*pub static COLOR_TYPE_NUMMAP: Map<&'static str, png::ColorType> = phf_map! {
|
||||
"dwadzieścia cztery" => png::ColorType::Rgb,
|
||||
"trzydzieści dwa" => png::ColorType::Rgba,
|
||||
};
|
||||
};*/
|
||||
|
|
1275
src/nummatch.rs
Normal file
1275
src/nummatch.rs
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue