commit 3f416ef524a0bb939554f6b73a25ac885dfdf574
parent 1240d29f8fcf390bcd2cb2fd6e916c629364009a
Author: Phạm Bình An <111893501+brianhuster@users.noreply.github.com>
Date: Sun, 3 Aug 2025 05:58:11 +0700
build: bump lua-bitop to 1.0.3 #35063
Source: https://bitop.luajit.org/download.html
Diffstat:
2 files changed, 5 insertions(+), 14 deletions(-)
diff --git 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
@@ -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 <stdint.h>
-#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);