nixio:
Add Rockspec Add bswap to nixio.bit Fix nixio.bit documentation
This commit is contained in:
parent
7ac3bac569
commit
dae7f3f4d5
3 changed files with 55 additions and 3 deletions
|
@ -10,6 +10,12 @@ module "nixio.bit"
|
|||
-- @param ... More Operands
|
||||
-- @return number
|
||||
|
||||
--- Invert given number.
|
||||
-- @class function
|
||||
-- @name bnot
|
||||
-- @param oper Operand
|
||||
-- @return number
|
||||
|
||||
--- Bitwise AND several numbers.
|
||||
-- @class function
|
||||
-- @name band
|
||||
|
@ -28,21 +34,21 @@ module "nixio.bit"
|
|||
|
||||
--- Left shift a number.
|
||||
-- @class function
|
||||
-- @name shl
|
||||
-- @name lshift
|
||||
-- @param oper number
|
||||
-- @param shift bits to shift
|
||||
-- @return number
|
||||
|
||||
--- Right shift a number.
|
||||
-- @class function
|
||||
-- @name shr
|
||||
-- @name rshift
|
||||
-- @param oper number
|
||||
-- @param shift bits to shift
|
||||
-- @return number
|
||||
|
||||
--- Arithmetically right shift a number.
|
||||
-- @class function
|
||||
-- @name ashr
|
||||
-- @name arshift
|
||||
-- @param oper number
|
||||
-- @param shift bits to shift
|
||||
-- @return number
|
||||
|
|
37
libs/nixio/nixio-0.3-1.rockspec
Normal file
37
libs/nixio/nixio-0.3-1.rockspec
Normal file
|
@ -0,0 +1,37 @@
|
|||
package = "nixio"
|
||||
version = "0.3-1"
|
||||
source = {
|
||||
url = "http://dev.luci.freifunk-halle.net/nixio/nixio-0.3.tar.bz2"
|
||||
}
|
||||
description = {
|
||||
summary = "System, Networking and I/O library for Lua",
|
||||
detailed = [[
|
||||
Nixio is a multi-platform library offering a wide variety
|
||||
of features such as IPv4, IPv6 and UNIX networking, large file I/O, file
|
||||
system operations, system and process control, POSIX user/group management,
|
||||
basic cryptographical hashing, hmac and TLS support, bit operations and
|
||||
binary conversion.
|
||||
]],
|
||||
homepage = "http://luci.subsignal.org",
|
||||
license = "Apache 2.0",
|
||||
maintainer = "Steven Barth",
|
||||
}
|
||||
dependencies = {
|
||||
"lua >= 5.1"
|
||||
}
|
||||
external_dependencies = {
|
||||
OPENSSL = {
|
||||
header = "openssl/ssl.h",
|
||||
}
|
||||
}
|
||||
build = {
|
||||
type = "make",
|
||||
build_variables = {
|
||||
NIXIO_LDFLAGS = "-lcrypt -L$(OPENSSL_LIBDIR) -I$(OPENSSL_INCDIR)",
|
||||
LUA_CFLAGS = "$(CFLAGS) -I$(LUA_INCDIR)",
|
||||
},
|
||||
install_variables = {
|
||||
LUA_MODULEDIR = "$(LUADIR)",
|
||||
LUA_LIBRARYDIR = "$(LIBDIR)",
|
||||
},
|
||||
}
|
|
@ -97,6 +97,13 @@ static int nixio_bit_cast(lua_State *L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int nixio_bit_swap(lua_State *L) {
|
||||
uint64_t op = luaL_checknumber(L, 1);
|
||||
op = (op >> 24) | ((op >> 8) & 0xff00) | ((op & 0xff00) << 8) | (op << 24);
|
||||
lua_pushnumber(L, op);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* module table */
|
||||
static const luaL_reg R[] = {
|
||||
{"bor", nixio_bit_or},
|
||||
|
@ -111,6 +118,8 @@ static const luaL_reg R[] = {
|
|||
{"div", nixio_bit_div},
|
||||
{"check", nixio_bit_check},
|
||||
{"cast", nixio_bit_cast},
|
||||
{"tobit", nixio_bit_cast},
|
||||
{"bswap", nixio_bit_swap},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue