From 065fb586a186712b4f26ca552ab56c8b434b6575 Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Wed, 30 Jan 2013 22:44:42 +0200 Subject: [PATCH] Remove quvi/bit Use the Lua bit operations (bitop) module in the scripts from now on. The module provides a more complete bit operation collection. http://bitop.luajit.org/api.html This adds a new prerequisite (Lua bitop) to libquvi-scripts. Signed-off-by: Toni Gundogdu --- README | 6 ++++++ share/Makefile.am | 3 ++- share/common/quvi/bit.lua | 47 ----------------------------------------------- 3 files changed, 8 insertions(+), 48 deletions(-) delete mode 100644 share/common/quvi/bit.lua diff --git a/README b/README index 9ba4821..0bf8db4 100644 --- a/README +++ b/README @@ -92,6 +92,12 @@ Requirements e.g. $ aptitude install liblua5.1-expat +* Lua bitop 1.0.1 + http://bitop.luajit.org/ + + e.g. + $ aptitude install liblua5.1-bitop0 + * pkg-config for tracking the compilation flags needed for libraries http://www.freedesktop.org/software/pkgconfig/ diff --git a/share/Makefile.am b/share/Makefile.am index 817d156..b1adbcf 100644 --- a/share/Makefile.am +++ b/share/Makefile.am @@ -3,7 +3,6 @@ commondir=$(pkgdatadir)/$(VERSION)/common/quvi/ dist_common_DATA=\ - common/quvi/bit.lua\ common/quvi/const.lua\ common/quvi/debug.lua\ common/quvi/entity.lua\ @@ -94,3 +93,5 @@ dist_version_DATA=version install-data-hook: cd $(DESTDIR)$(pkgdatadir) && rm -f $(VERSION_MM) && \ $(LN_S) $(VERSION) $(VERSION_MM) + +# vim: set ts=2 sw=2 tw=72 expandtab: diff --git a/share/common/quvi/bit.lua b/share/common/quvi/bit.lua deleted file mode 100644 index 6cdbfdf..0000000 --- a/share/common/quvi/bit.lua +++ /dev/null @@ -1,47 +0,0 @@ --- libquvi-scripts --- Copyright (C) 2010 Toni Gundogdu --- --- This file is part of libquvi-scripts . --- --- This program is free software: you can redistribute it and/or --- modify it under the terms of the GNU Affero General Public --- License as published by the Free Software Foundation, either --- version 3 of the License, or (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU Affero General Public License for more details. --- --- You should have received a copy of the GNU Affero General --- Public License along with this program. If not, see --- . --- - -local M = {} - -function M.bit_or(x, y) -- http://is.gd/iVg4x - local p = 1 - while p < x do p = p + p end - while p < y do p = p + p end - local z = 0 - repeat - if p <= x or p <= y then - z = z + p - if p <= x then x = x - p end - if p <= y then y = y - p end - end - p = p * 0.5 - until p < 1 - return z -end - --- 1-based indexing -function M.bit(p) return 2 ^ (p - 1) end - --- e.g. "if has_bit (foo, bit (n)) then ..." -function M.has_bit(x, p) return x % (p + p) >= p end - -return M - --- vim: set ts=2 sw=2 tw=72 expandtab: -- 2.11.4.GIT