lua-users home
lua-l archive

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


(sorry to reply to my own question, but) this gives me the result I
want, i.e. same as what gcc returns:

local function mul_u32(x1, x2)
	return tonumber(ffi.cast('uint32_t', ffi.cast('uint32_t', x1) *
ffi.cast('uint32_t', x2)))
end

mul_u32(0xcc9e2d51, 0xcc9e2d51) -> 0x100193a1

Is this acceptable speedwise or are all of these numbers heap objects?

@Daurnimator: the reason for not keeping everything as cdata objects
is that the bitop library only takes Lua numbers, so I would have to
tonumber() them anyway.