raw bytes instead of str

This commit is contained in:
Jonathan Kelley committed 2024-03-06 18:16:09 -08:00
1 parent 99748a611c
commit f65ded2cb4
1 file changed
+6 -6
+6 -6
View File
@@ -28,19 +28,19 @@ fn main() {
fn hash_ts_files() -> u128 { fn hash_ts_files() -> u128 {
let mut out = 0; let mut out = 0;
let files = [ let files: &[&[u8]] = &[
include_str!("src/ts/common.ts"), include_bytes!("src/ts/common.ts"),
include_str!("src/ts/native.ts"), include_bytes!("src/ts/native.ts"),
include_str!("src/ts/core.ts"), include_bytes!("src/ts/core.ts"),
]; ];
// Let's make the dumbest hasher by summing the bytes of the files // Let's make the dumbest hasher by summing the bytes of the files
// The location is multiplied by the byte value to make sure that the order of the bytes matters // The location is multiplied by the byte value to make sure that the order of the bytes matters
let mut idx = 0; let mut idx = 0;
for file in files { for file in files {
for byte in file.bytes() { for byte in file.iter() {
idx += 1; idx += 1;
out += (byte as u128) * (idx as u128); out += (*byte as u128) * (idx as u128);
} }
} }
out out