Can I build CHDK with int64_t as LUA_NUMBER?
Lua itself should be fine with any of the the supported LUA_NUMBER configurations. Personally, I'd probably try floats before 64 bit ints, since the hardware doesn't support either and floats are closer to standard Lua.
However, the code in modules/luascript.c assumes numbers are 32 bit ints, and a significant number of things would probably break in either case. It would also be a lot slower and probably larger, and you might need to import some additional functions gcc builtin functions in the module_exportlist.* files.
Making a workaround for stat using the bitwise operator functions, or updating stat to store the size in a different way in the C code would be much simpler.
you could do something like
local _orig_stat=os.stat
os.stat=function(...)
local st,err,errno=_orig_stat(...)
if not st then
return st,err,errno
end
st.size_kb = bitshru(st.size,10)
return st
end
st.size_kb would be the size rounded down to the nearest kb. You could make it round or preserve the remainder in another field, of course.