---
-- Bitwise operations on integers.
--
-- Lua does not provide bitwise logical operations. Since they are often useful
-- for low-level network communication, Reuben Thomas' BitLib
-- (http://luaforge.net/projects/bitlib) for Lua has been integrated into NSE.
-- The arguments to the bitwise operation functions should be integers. The
-- number of bits available for logical operations depends on the data type used
-- to represent Lua numbers. This is typically 8-byte IEEE floats (double),
-- which give 53 bits (the size of the mantissa).
--
-- This implies that the bitwise operations won't work (as expected) for numbers
-- larger than 10^14. You can use them with 32-bit wide numbers without any
-- problems. Operations involving 64-bit wide numbers, however, may not return
-- the expected result.
--
-- The logical operations start with "b" to avoid
-- clashing with reserved words; although `xor`

isn't a
-- reserved word, it seemed better to use `bxor`

for
-- consistency.
--
-- @author Reuben Thomas
-- @copyright BSD License
module "bit"
--- Returns the one's complement of `a`

.
-- @param a Number.
-- @return The one's complement of `a`

.
function bnot(a)
--- Returns the bitwise and of all its arguments.
-- @param ... A variable number of Numbers to and.
-- @return The anded result.
function band(...)
--- Returns the bitwise or of all its arguments.
-- @param ... A variable number of Numbers to or.
-- @return The ored result.
function bor(...)
--- Returns the bitwise exclusive or of all its arguments.
-- @param ... A variable number of Numbers to exclusive or.
-- @return The exclusive ored result.
function bxor(...)
--- Returns `a`

left-shifted by `b`

places.
-- @param a Number to perform the shift on.
-- @param b Number of shifts.
function lshift(a, b)
--- Returns `a`

right-shifted by `b`

places.
-- @param a Number to perform the shift on.
-- @param b Number of shifts.
function rshift(a, b)
--- Returns `a`

arithmetically right-shifted by `b`

-- places.
-- @param a Number to perform the shift on.
-- @param b Number of shifts.
function arshift(a, b)
--- Returns the integer remainder of `a`

divided by `b`

.
-- @param a Dividend.
-- @param b Divisor.
function mod(a, b)