mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
build: bump lua-bitop to 1.0.3 #35063
Source: https://bitop.luajit.org/download.html
This commit is contained in:
@@ -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:
|
||||
|
17
src/bit.c
17
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);
|
||||
|
Reference in New Issue
Block a user