weekend work
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use clap::{Arg, Command};
|
||||
use std::fs::File;
|
||||
use std::io;
|
||||
use std::io::{BufReader, Read};
|
||||
use clap::{Arg, Command};
|
||||
|
||||
#[derive(Debug)]
|
||||
struct CliArgs {
|
||||
@@ -19,7 +19,6 @@ fn main() {
|
||||
.required(true)
|
||||
.index(1),
|
||||
)
|
||||
|
||||
.get_matches();
|
||||
|
||||
// Parse the command-line arguments
|
||||
@@ -53,12 +52,12 @@ fn read_file_to_bools(file_path: &str) -> io::Result<Vec<u8>> {
|
||||
let bit = match byte {
|
||||
b'1' => true,
|
||||
b'0' => false,
|
||||
_ => continue, // Skip non-'1' or '0' characters
|
||||
_ => continue, // Skip non-'1' or '0' characters
|
||||
};
|
||||
|
||||
// Set the appropriate bit in the current byte
|
||||
if bit {
|
||||
current_byte |= 1 << (7 - bit_index); // Set the bit at the correct position
|
||||
current_byte |= 1 << (7 - bit_index); // Set the bit at the correct position
|
||||
}
|
||||
|
||||
bit_index += 1;
|
||||
@@ -76,8 +75,5 @@ fn read_file_to_bools(file_path: &str) -> io::Result<Vec<u8>> {
|
||||
output.push(current_byte);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Ok(output)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user