#[allow(non_camel_case_types)]
pub type q7 = i8;
#[allow(non_camel_case_types)]
pub type q15 = i16;
#[allow(non_camel_case_types)]
pub type q31 = i32;
#[allow(non_camel_case_types)]
pub type q63 = i64;
#[allow(non_camel_case_types)]
pub type f32_t = f32;
#[allow(non_camel_case_types)]
pub type f64_t = f64;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(i8)]
pub enum Status {
Success = 0,
ArgumentError = -1,
LengthError = -2,
SizeMismatch = -3,
NanInf = -4,
Singular = -5,
TestFailure = -6,
DecompositionFailure = -7,
}
#[derive(Debug, Clone, Copy, PartialEq, Default)]
#[repr(C)]
pub struct Complex<T> {
pub real: T,
pub imag: T,
}
impl<T> Complex<T> {
#[inline(always)]
pub const fn new(real: T, imag: T) -> Self {
Self { real, imag }
}
}
#[inline(always)]
pub fn q15_mult(a: q15, b: q15) -> q15 {
let mul = (a as i32 * b as i32) >> 15;
mul.clamp(i16::MIN as i32, i16::MAX as i32) as i16
}
#[inline(always)]
pub fn q31_mult(a: q31, b: q31) -> q31 {
let mul = (a as i64 * b as i64) >> 31;
mul.clamp(i32::MIN as i64, i32::MAX as i64) as i32
}
#[inline(always)]
pub fn q7_mult(a: q7, b: q7) -> q7 {
let mul = (a as i32 * b as i32) >> 7;
mul.clamp(i8::MIN as i32, i8::MAX as i32) as i8
}