diff options
author | Malfurious <m@lfurio.us> | 2021-11-25 01:16:18 -0500 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2021-11-25 01:16:18 -0500 |
commit | 30686a8e693f2d61bda933d1370b6ea50b8bf0a6 (patch) | |
tree | 91f3ed277465f1a7426acea31c7074faf1d1a32f /src | |
parent | 16ac36edf6250e1b8f414adec0fccccf5770c247 (diff) | |
download | SorensenCompression-30686a8e693f2d61bda933d1370b6ea50b8bf0a6.tar.gz SorensenCompression-30686a8e693f2d61bda933d1370b6ea50b8bf0a6.zip |
Remove redundant rust code
This logic has already been reimplemented in C, or is otherwise
unneeded.
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'src')
-rw-r--r-- | src/iter.rs | 10 | ||||
-rw-r--r-- | src/load_file.rs | 12 | ||||
-rw-r--r-- | src/main.rs | 31 |
3 files changed, 0 insertions, 53 deletions
diff --git a/src/iter.rs b/src/iter.rs deleted file mode 100644 index f8aa6cb..0000000 --- a/src/iter.rs +++ /dev/null @@ -1,10 +0,0 @@ -use num::BigInt; - -pub fn next(v: &BigInt) -> BigInt -{ - /*let t: BigUint = v | (v - 1); - (t + 1) | (((!t & -!t) - 1) >> (v.trailing_zeros() + 1))*/ - - let t: BigInt = (v | (v - 1u32)) + 1u32; - &t | ((((&t & -&t) / (v & -v)) >> 1) - 1u32) -} diff --git a/src/load_file.rs b/src/load_file.rs deleted file mode 100644 index 0fd1541..0000000 --- a/src/load_file.rs +++ /dev/null @@ -1,12 +0,0 @@ -use std::fs::File; -use std::io::Read; - -pub fn load_file_vec(path: &String) -> std::io::Result<Vec<u8>> -{ - let mut file = File::open(path)?; - let mut data = Vec::new(); - - file.read_to_end(&mut data)?; - - Ok(data) -} diff --git a/src/main.rs b/src/main.rs index bfed16b..5197cbe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,34 +1,3 @@ -mod iter; -mod load_file; -mod demo_hash; - -use num::BigInt; -use num::bigint::Sign; - -fn vec_pop_cnt(v: &Vec<u8>) -> u32 -{ - let mut cnt = 0; - - for x in v - { - cnt += x.count_ones(); - } - - cnt -} - -fn pop_cnt_vec(c: u32) -> Vec<u8> -{ - let mut v = Vec::new(); - v.push(2u8.pow(c % 8) - 1); - for _ in 0..(c / 8) - { - v.push(0xff); - } - - v -} - fn main() { /* "Compression" setup */ |