luaur_compiler/methods/
compiler_encode_hash_size.rs1use crate::records::compiler::Compiler;
2
3impl Compiler {
4 pub fn encode_hash_size(hash_size: u32) -> u8 {
5 if hash_size == 0 {
6 return 0;
7 }
8
9 let mut hash_size_log2 = 0;
10 while (1u32 << hash_size_log2) < hash_size {
11 hash_size_log2 += 1;
12 }
13
14 (hash_size_log2 + 1) as u8
15 }
16}