From 79f6b161f892f621a909ce1df99b3c680f3682a2 Mon Sep 17 00:00:00 2001 From: Sunil Nimmagadda Date: Fri, 23 Oct 2026 22:43:44 +0530 Subject: Refactor: Move to an elf module. While here, define a elf.d.lua to help author type check configuration file. --- elf/fmt.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 elf/fmt.lua (limited to 'elf/fmt.lua') diff --git a/elf/fmt.lua b/elf/fmt.lua new file mode 100644 index 0000000..44498d4 --- /dev/null +++ b/elf/fmt.lua @@ -0,0 +1,17 @@ +local constants = require("elf.constants") + +local M = {} + +---@param endian Endian +---@nodiscard +function M.endian(endian) + return (endian == constants.Endian.big) and ">" or "<" +end + +---@param class Class +---@nodiscard +function M.word(class) + return (class == constants.Class.bit64) and "I8" or "I4" +end + +return M -- cgit v1.3