add SANE_{,UN}FIX
This commit is contained in:
parent
da7d757e1c
commit
4fa167eb2a
|
@ -16,6 +16,14 @@ pub const fn SANE_VERSION_BUILD(code: SANE_Int) -> SANE_Word {
|
|||
(code >> 0) as SANE_Word & 0xffff
|
||||
}
|
||||
|
||||
pub fn SANE_FIX(v: f64) -> SANE_Word {
|
||||
(v * (1 << SANE_FIXED_SCALE_SHIFT) as f64) as SANE_Word
|
||||
}
|
||||
|
||||
pub fn SANE_UNFIX(v: SANE_Word) -> f64 {
|
||||
v as f64 / (1 << SANE_FIXED_SCALE_SHIFT) as f64
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Reference in New Issue