use crate::constants::constants_system::SIZE_32KB;
use crate::periph::at28c256::At28C256;
use crate::constants::constants_test::*;

impl At28C256 {
    /// checksum
    ///
    /// calculates and returns the checksum for the loaded binary.
    /// files with all zero will calculate to zero
    pub fn checksum(&self) -> u8 {
        At28C256::checksum_static(&self.data[..])
    }

    pub fn checksum_static(data: &[u8]) -> u8 {
        data.iter().fold(0u8, |acc, &b| acc.wrapping_add(b))
    }
}

