1*f0c87a89SGnoCiYeH pub const MAX_NICE: i32 = 20; 2*f0c87a89SGnoCiYeH pub const MIN_NICE: i32 = -20; 3*f0c87a89SGnoCiYeH pub const NICE_WIDTH: i32 = MAX_NICE - MIN_NICE + 1; 4*f0c87a89SGnoCiYeH 5*f0c87a89SGnoCiYeH pub const MAX_RT_PRIO: i32 = 100; 6*f0c87a89SGnoCiYeH pub const MAX_PRIO: i32 = MAX_RT_PRIO + NICE_WIDTH; 7*f0c87a89SGnoCiYeH #[allow(dead_code)] 8*f0c87a89SGnoCiYeH pub const DEFAULT_PRIO: i32 = MAX_RT_PRIO + NICE_WIDTH / 2; 9*f0c87a89SGnoCiYeH 10*f0c87a89SGnoCiYeH pub const MAX_DL_PRIO: i32 = 0; 11*f0c87a89SGnoCiYeH pub struct PrioUtil; 12*f0c87a89SGnoCiYeH #[allow(dead_code)] 13*f0c87a89SGnoCiYeH impl PrioUtil { 14*f0c87a89SGnoCiYeH #[inline] nice_to_prio(nice: i32) -> i3215*f0c87a89SGnoCiYeH pub fn nice_to_prio(nice: i32) -> i32 { 16*f0c87a89SGnoCiYeH nice + DEFAULT_PRIO 17*f0c87a89SGnoCiYeH } 18*f0c87a89SGnoCiYeH 19*f0c87a89SGnoCiYeH #[inline] prio_to_nice(prio: i32) -> i3220*f0c87a89SGnoCiYeH pub fn prio_to_nice(prio: i32) -> i32 { 21*f0c87a89SGnoCiYeH prio - DEFAULT_PRIO 22*f0c87a89SGnoCiYeH } 23*f0c87a89SGnoCiYeH 24*f0c87a89SGnoCiYeH #[inline] dl_prio(prio: i32) -> bool25*f0c87a89SGnoCiYeH pub fn dl_prio(prio: i32) -> bool { 26*f0c87a89SGnoCiYeH return prio < MAX_DL_PRIO; 27*f0c87a89SGnoCiYeH } 28*f0c87a89SGnoCiYeH 29*f0c87a89SGnoCiYeH #[inline] rt_prio(prio: i32) -> bool30*f0c87a89SGnoCiYeH pub fn rt_prio(prio: i32) -> bool { 31*f0c87a89SGnoCiYeH return prio < MAX_RT_PRIO; 32*f0c87a89SGnoCiYeH } 33*f0c87a89SGnoCiYeH } 34