2 * Copyright (c) 2023, Netflix, Inc
4 * SPDX-License-Identifier: BSD-2-Clause
9 * We need to always define this. For the boot loader, we use it. For flua
10 * we don't, but it needs to be defined to keep some ifdefs happy.
12 #define LUA_FLOAT_INT64 4
14 /* set the paths we want */
18 #define LUA_ROOT LUA_PATH "/" LUA_VDIR "/"
19 #define LUA_LDIR LUA_ROOT "share/"
20 #define LUA_CDIR LUA_ROOT "lib/"
22 /* Simplify this, since it's always an int */
23 #undef lua_numbertointeger
24 #define lua_numbertointeger(n,p) \
25 (*(p) = (LUA_INTEGER)(n), 1)
27 /* Define our number type by brute force, but first undo the default defines */
32 #undef LUA_NUMBER_FRMLEN
36 #undef lua_getlocaledecpoint
39 #define LUA_FLOAT_TYPE LUA_FLOAT_INT64
43 #include <machine/_inttypes.h>
45 #define panic lua_panic
46 /* Hack to use int64 as the LUA_NUMBER from ZFS code, kinda */
48 #define LUA_NUMBER int64_t
50 #define l_floatatt(n) (LUA_FLOAT_INT_HACK_##n)
51 #define LUA_FLOAT_INT_HACK_MANT_DIG 32
52 #define LUA_FLOAT_INT_HACK_MAX_10_EXP 32
54 #define LUAI_UACNUMBER int64_t
56 #define LUA_NUMBER_FRMLEN ""
57 #define LUA_NUMBER_FMT "%" PRId64
59 #define l_mathop(x) (lstd_ ## x)
61 #define lua_str2number(s,p) strtoll((s), (p), 0)
63 #define lua_getlocaledecpoint() '.'
65 /* Better buffer size */
66 #undef LUAL_BUFFERSIZE
67 #define LUAL_BUFFERSIZE 128
69 /* Maxalign can't reference double */
71 #define LUAI_MAXALIGN lua_Number n; void *s; lua_Integer i; long l
73 #define LUA_AVOID_FLOAT