Skip to content

Commit 611e08c

Browse files
committed
style: fix formatting and add CPU instruction names to spell checker
- Run cargo fmt to fix line length issues in tests - Add 'vpclmulqdq' (AVX512 instruction) to jargon dictionary - Add 'ssse' (SSE instruction set) to jargon dictionary - All 15 unit tests still passing ✅
1 parent d466757 commit 611e08c

File tree

2 files changed

+31
-11
lines changed

2 files changed

+31
-11
lines changed

.vscode/cspell.dictionaries/jargon.wordlist.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ codegen
1919
colorizable
2020
colorize
2121
coprime
22+
vpclmulqdq
2223
consts
2324
conv
2425
cyclomatic
@@ -131,6 +132,7 @@ shortcode
131132
shortcodes
132133
siginfo
133134
sigusr
135+
ssse
134136
strcasecmp
135137
subcommand
136138
subexpression

src/uucore/src/lib/features/sum.rs

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,7 @@ impl Digest for CRC32B {
431431
let optimal_size = if cfg!(target_arch = "x86_64") {
432432
#[cfg(target_arch = "x86_64")]
433433
{
434-
if has_avx512 {
435-
65536
436-
} else {
437-
8192
438-
}
434+
if has_avx512 { 65536 } else { 8192 }
439435
}
440436
#[cfg(not(target_arch = "x86_64"))]
441437
{
@@ -637,14 +633,24 @@ mod crc32b_tests {
637633
fn test_crc32b_known_vector_1() {
638634
let (data, expected) = TEST_VECTOR_1;
639635
let result = compute_crc32b(data);
640-
assert_eq!(result, expected, "Failed for input: {:?}", std::str::from_utf8(data));
636+
assert_eq!(
637+
result,
638+
expected,
639+
"Failed for input: {:?}",
640+
std::str::from_utf8(data)
641+
);
641642
}
642643

643644
#[test]
644645
fn test_crc32b_known_vector_2() {
645646
let (data, expected) = TEST_VECTOR_2;
646647
let result = compute_crc32b(data);
647-
assert_eq!(result, expected, "Failed for input: {:?}", std::str::from_utf8(data));
648+
assert_eq!(
649+
result,
650+
expected,
651+
"Failed for input: {:?}",
652+
std::str::from_utf8(data)
653+
);
648654
}
649655

650656
#[test]
@@ -725,7 +731,10 @@ mod crc32b_tests {
725731
crc2.hash_finalize(&mut out2);
726732
let result2 = u32::from_be_bytes(out2);
727733

728-
assert_eq!(result1, result2, "Incremental updates should match single update");
734+
assert_eq!(
735+
result1, result2,
736+
"Incremental updates should match single update"
737+
);
729738
}
730739

731740
#[test]
@@ -751,7 +760,10 @@ mod crc32b_tests {
751760
let mut crc = CRC32B::new();
752761
crc.hash_update(b"Test");
753762
let result_str = crc.result_str();
754-
assert_eq!(result_str, "2018365746", "result_str should match expected format");
763+
assert_eq!(
764+
result_str, "2018365746",
765+
"result_str should match expected format"
766+
);
755767
}
756768

757769
#[test]
@@ -770,7 +782,10 @@ mod crc32b_tests {
770782
let result2 = compute_crc32b(&data);
771783

772784
// Results should be different
773-
assert_ne!(result1, result2, "Different inputs should produce different CRCs");
785+
assert_ne!(
786+
result1, result2,
787+
"Different inputs should produce different CRCs"
788+
);
774789
}
775790

776791
#[test]
@@ -783,7 +798,10 @@ mod crc32b_tests {
783798
let result2 = compute_crc32b(&data);
784799

785800
// Results should be different
786-
assert_ne!(result1, result2, "Different inputs should produce different CRCs");
801+
assert_ne!(
802+
result1, result2,
803+
"Different inputs should produce different CRCs"
804+
);
787805
}
788806

789807
#[test]

0 commit comments

Comments
 (0)