From 3f416ef524a0bb939554f6b73a25ac885dfdf574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20B=C3=ACnh=20An?= <111893501+brianhuster@users.noreply.github.com> Date: Sun, 3 Aug 2025 05:58:11 +0700 Subject: [PATCH] build: bump lua-bitop to 1.0.3 #35063 Source: https://bitop.luajit.org/download.html --- runtime/doc/lua-bit.txt | 2 +- src/bit.c | 17 ++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/runtime/doc/lua-bit.txt b/runtime/doc/lua-bit.txt index 91df5937e4..e703a03d05 100644 --- a/runtime/doc/lua-bit.txt +++ b/runtime/doc/lua-bit.txt @@ -376,7 +376,7 @@ strongly advised not to rely on undefined or implementation-defined behavior. ============================================================================== COPYRIGHT -Lua BitOp is Copyright (C) 2008-2012 Mike Pall. +Lua BitOp is Copyright (C) 2008-2025 Mike Pall. Lua BitOp is free software, released under the MIT license. vim:tw=78:ts=4:sw=4:sts=4:et:ft=help:norl: diff --git a/src/bit.c b/src/bit.c index 85d2414582..7fd6c543de 100644 --- a/src/bit.c +++ b/src/bit.c @@ -2,7 +2,7 @@ ** Lua BitOp -- a bit operations library for Lua 5.1/5.2. ** http://bitop.luajit.org/ ** -** Copyright (C) 2008-2012 Mike Pall. All rights reserved. +** Copyright (C) 2008-2025 Mike Pall. All rights reserved. ** ** Permission is hereby granted, free of charge, to any person obtaining ** a copy of this software and associated documentation files (the @@ -26,22 +26,13 @@ ** [ MIT license: http://www.opensource.org/licenses/mit-license.php ] */ -#define LUA_BITOP_VERSION "1.0.2" +#define LUA_BITOP_VERSION "1.0.3" #define LUA_LIB #include "lua.h" #include "lauxlib.h" -#include "bit.h" - -#ifdef _MSC_VER -/* MSVC is stuck in the last century and doesn't have C99's stdint.h. */ -typedef __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -#else #include -#endif typedef int32_t SBits; typedef uint32_t UBits; @@ -129,11 +120,11 @@ static int bit_bswap(lua_State *L) static int bit_tohex(lua_State *L) { UBits b = barg(L, 1); - SBits n = lua_isnone(L, 2) ? 8 : (SBits)barg(L, 2); + UBits n = lua_isnone(L, 2) ? 8 : barg(L, 2); const char *hexdigits = "0123456789abcdef"; char buf[8]; int i; - if (n < 0) { n = -n; hexdigits = "0123456789ABCDEF"; } + if ((SBits)n < 0) { n = ~n+1; hexdigits = "0123456789ABCDEF"; } if (n > 8) n = 8; for (i = (int)n; --i >= 0; ) { buf[i] = hexdigits[b & 15]; b >>= 4; } lua_pushlstring(L, buf, (size_t)n);