luaur-bytecode 0.1.3

Luau bytecode format and builder (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::records::bc_inst_hash::BcInstHash;
use crate::records::bc_op::BcOp;

impl BcInstHash {
    pub fn mix_u32_bc_op(h: u32, op: BcOp) -> u32 {
        let mut k: u32 = 0;
        unsafe {
            core::ptr::copy_nonoverlapping(
                &op as *const BcOp as *const u8,
                &mut k as *mut u32 as *mut u8,
                core::mem::size_of::<BcOp>(),
            );
        }
        Self::mix_u32_u32(h, k)
    }
}