use crate::records::lua_node::LuaNode;
use crate::records::lua_table::LuaTable;
#[allow(non_snake_case)]
pub(crate) unsafe fn hashint(t: *const LuaTable, n: i64) -> *mut LuaNode {
let mut i: [u32; 2] = [0; 2];
core::ptr::copy_nonoverlapping(&n as *const i64 as *const u8, i.as_mut_ptr() as *mut u8, 8);
let mut h1 = i[0];
let mut h2 = i[1];
const M: u32 = 0x5bd1e995;
h1 ^= h2 >> 18;
h1 = h1.wrapping_mul(M);
h2 ^= h1 >> 22;
h2 = h2.wrapping_mul(M);
h1 ^= h2 >> 17;
h1 = h1.wrapping_mul(M);
h2 ^= h1 >> 19;
h2 = h2.wrapping_mul(M);
crate::macros::gnode::gnode!(
t,
crate::macros::lmod::lmod!(h2 as i32, crate::macros::sizenode::sizenode!(t)) as usize
)
}