#![forbid(unsafe_code)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Strategy {
Fast,
DFast,
}
#[derive(Debug, Clone, Copy)]
pub struct LevelParams {
pub strategy: Strategy,
pub window_log: u32,
pub hash_log: u32,
pub search_log: u32,
pub min_match: u32,
pub target_length: u32,
pub search_strength: u32,
}
pub fn level_params(level: i32) -> Option<LevelParams> {
Some(match level {
-7 => LevelParams {
strategy: Strategy::Fast,
window_log: 19,
hash_log: 13,
search_log: 0,
min_match: 4,
target_length: 8,
search_strength: 7,
},
-6 => LevelParams {
strategy: Strategy::Fast,
window_log: 19,
hash_log: 13,
search_log: 0,
min_match: 4,
target_length: 7,
search_strength: 7,
},
-5 => LevelParams {
strategy: Strategy::Fast,
window_log: 19,
hash_log: 13,
search_log: 0,
min_match: 4,
target_length: 6,
search_strength: 7,
},
-4 => LevelParams {
strategy: Strategy::Fast,
window_log: 19,
hash_log: 13,
search_log: 0,
min_match: 4,
target_length: 5,
search_strength: 7,
},
-3 => LevelParams {
strategy: Strategy::Fast,
window_log: 19,
hash_log: 13,
search_log: 0,
min_match: 4,
target_length: 4,
search_strength: 7,
},
-2 => LevelParams {
strategy: Strategy::Fast,
window_log: 19,
hash_log: 13,
search_log: 0,
min_match: 4,
target_length: 3,
search_strength: 7,
},
-1 => LevelParams {
strategy: Strategy::Fast,
window_log: 19,
hash_log: 13,
search_log: 0,
min_match: 4,
target_length: 2,
search_strength: 7,
},
1 => LevelParams {
strategy: Strategy::Fast,
window_log: 19,
hash_log: 14,
search_log: 0,
min_match: 7,
target_length: 1,
search_strength: 8,
},
2 => LevelParams {
strategy: Strategy::Fast,
window_log: 20,
hash_log: 16,
search_log: 0,
min_match: 6,
target_length: 1,
search_strength: 8,
},
3 => LevelParams {
strategy: Strategy::DFast,
window_log: 21,
hash_log: 17,
search_log: 1,
min_match: 5,
target_length: 1,
search_strength: 4,
},
4 => LevelParams {
strategy: Strategy::DFast,
window_log: 21,
hash_log: 18,
search_log: 1,
min_match: 5,
target_length: 1,
search_strength: 4,
},
_ => return None,
})
}