()
| 125 | } |
| 126 | |
| 127 | fn runtime_cache_key() -> String { |
| 128 | let mut fp: u64 = 0; |
| 129 | for (index, chunk) in [resources::LIBKRUN, resources::LIBKRUNFW] |
| 130 | .into_iter() |
| 131 | .chain(std::iter::once(resources::GVPROXY)) |
| 132 | .enumerate() |
| 133 | { |
| 134 | let sample = &chunk[..chunk.len().min(64)]; |
| 135 | let mut word: u64 = 0; |
| 136 | for (offset, byte) in sample.iter().enumerate() { |
| 137 | word ^= u64::from(*byte) << ((offset % 8) * 8); |
| 138 | } |
| 139 | let index_u32 = u32::try_from(index).unwrap_or(u32::MAX); |
| 140 | fp ^= word.rotate_left(index_u32 * 13 + 7); |
| 141 | fp ^= (chunk.len() as u64).rotate_left(index_u32 * 17 + 3); |
| 142 | } |
| 143 | format!("{VERSION}-{fp:016x}") |
| 144 | } |
| 145 | |
| 146 | fn runtime_cache_dir() -> Result<PathBuf, String> { |
| 147 | let base = |
no test coverage detected