Date: Fri, 15 Jan 2021 21:02:51 GMT From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 994e1f40f6db - main - lualoader: use floor division to get correct type Message-ID: <202101152102.10FL2phB033056@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=994e1f40f6db059290cf4a8203c2b9eea22d9a38 commit 994e1f40f6db059290cf4a8203c2b9eea22d9a38 Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2021-01-15 14:15:40 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2021-01-15 21:02:38 +0000 lualoader: use floor division to get correct type This fixes the positioning of the "Welcome to FreeBSD" heading, which was misplaced after the recent update to Lua 5.4. The issue was previously masked by a compatibility knob in Lua 5.3 that would cause float-tagged numbers to render faithfully without the decimal component. Lua 5.4 dropped that and ensures that it always prints a decimal component, even if it has to append a ".0" to the value. Standard division produces a "float", floor division (//) can be used to guarantee an integer. Floating point operations have been completely ripped out of the liblua compiled for the bootloader, so this is a nop. This is decidedly better than trying to hack out the float tag entirely. Reported-by: mjg, probably others MFC-after: 3 days --- stand/lua/drawer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 3ace3884ff8a..6062d7e87a03 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -283,7 +283,7 @@ local function drawbox() end end if menu_header_x == nil then - menu_header_x = x + (w / 2) - (#menu_header / 2) + menu_header_x = x + (w // 2) - (#menu_header // 2) end screen.setcursor(menu_header_x, y) printc(menu_header)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101152102.10FL2phB033056>