luaur_bytecode/methods/
bc_inst_hash_operator_call.rs1use crate::records::bc_inst::BcInst;
2use crate::records::bc_inst_hash::BcInstHash;
3use crate::records::bc_op::BcOp;
4
5impl BcInstHash {
6 pub fn call(&self, key: &BcInst) -> usize {
7 let mut h: u32 = 25;
9
10 h = Self::mix_u32_u32(h, key.op as u32);
11 for i in 0..7 {
12 let op_val = if i < key.ops.len() {
13 key.ops[i]
14 } else {
15 BcOp::new()
16 };
17 h = Self::mix_u32_bc_op(h, op_val);
18 }
19
20 h ^= h >> 13;
22 h = h.wrapping_mul(Self::M);
23 h ^= h >> 15;
24
25 h as usize
26 }
27}