lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On 21 Jan 2013 12:35, "Cosmin Apreutesei" <cosmin.apreutesei@gmail.com> wrote:
>
> Hi,
>
> I wanted to port a hash function from C to LuaJIT. First thing the
> algorithm does is it takes the first uint32_t of the key and
> multiplies it with 0xcc9e2d51, the destination variable being itself a
> uint32_t. I don't know the semantics of this in C, but whatever it is,
> can I emulate this in LuaJIT / LuaBitOp or other library? This
> multiplication would exceed 53bit if it were between Lua numbers.
>
> Thanks.
>

See Daurnimator for the answer. Note though that this will be slower than using C so you may as well do a C binding anyway (I tried this recently).

Justin