mirror of
https://codeberg.org/ral/rwedid.git
synced 2024-08-16 09:59:49 +02:00
Fix docs
This commit is contained in:
parent
5091123905
commit
fcd239a3f7
1 changed files with 2 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
// Compute and check the checksum over the bytes of a block.
|
// Compute the checksum over the bytes of a block.
|
||||||
pub fn checksum(bytes: &[u8]) -> u8 {
|
pub fn checksum(bytes: &[u8]) -> u8 {
|
||||||
bytes.iter().fold(0u32, |x, y| x + (*y as u32)) as u8
|
bytes.iter().fold(0u32, |x, y| x + (*y as u32)) as u8
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ pub fn valid_checksum(bytes: &[u8]) -> bool {
|
||||||
checksum(bytes) == 0x00
|
checksum(bytes) == 0x00
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print the checksum to stdout
|
// Print the checksum to stderr
|
||||||
pub fn print_checksum(bytes: &[u8]) {
|
pub fn print_checksum(bytes: &[u8]) {
|
||||||
let cs = checksum(bytes);
|
let cs = checksum(bytes);
|
||||||
eprintln!(" Checksum is: {cs}");
|
eprintln!(" Checksum is: {cs}");
|
||||||
|
|
Loading…
Reference in a new issue