use redline::redline;

#[redline(latency = "< 10ms", allocs = "< 5", syscalls = 0)]
fn process_data(data: &[u8]) -> u64 {
    let mut result: u64 = 0;
    for i in 0..256 {
        result += data.get(i).copied().unwrap_or(0) as u64;
    }
    result
}

#[redline(latency = "< 500us")]
fn fast_hash(data: &[u8]) -> u64 {
    let mut h: u64 = 0xcbf29ce484222325;
    for i in 0..64 {
        let byte = data.get(i).copied().unwrap_or(0) as u64;
        h ^= byte;
        h = h.wrapping_mul(0x100000001b3);
    }
    h
}

#[redline(allocs = 0, syscalls = 0)]
fn pure_compute(a: f64, b: f64, c: f64) -> f64 {
    let discriminant = b * b - 4.0 * a * c;
    if discriminant >= 0.0 {
        (-b + discriminant) / (2.0 * a)
    } else {
        0.0
    }
}

fn main() {}
