Download code/bugfind/bench/kernels/mldsa_hint/post/src/lib.rs from viai957/align: direct link, hf CLI and curl.
- Browser
- Download file 610 Bytes
-
https://huggingface.co/viai957/align/resolve/main/code/bugfind/bench/kernels/mldsa_hint/post/src/lib.rs
- Command line
-
hf download hf://viai957/align/code/bugfind/bench/kernels/mldsa_hint/post/src/lib.rs
-
curl -L -o lib.rs https://huggingface.co/viai957/align/resolve/main/code/bugfind/bench/kernels/mldsa_hint/post/src/lib.rs
610 Bytes
| pub fn hint_weight(hint: &[u8], max_ones: usize, rows: usize) -> Option<usize> { | |
| let mut previous = 0usize; | |
| let mut total = 0usize; | |
| let mut bad = false; | |
| let mut i = 0usize; | |
| while i < rows { | |
| let current = hint[max_ones + i] as usize; | |
| if current < previous || current > max_ones { | |
| bad = true; | |
| } else { | |
| let mut j = previous; | |
| while j < current { | |
| total += hint[j] as usize; | |
| j += 1; | |
| } | |
| previous = current; | |
| } | |
| i += 1; | |
| } | |
| if bad { None } else { Some(total) } | |
| } | |