@head @module bitop @title bitop: Bitwise operations

This module provides basic bitwise operations. All operations expect integer arguments, and all operations are performed assuming signed 2's complement binary representations of integers. In the 2's complement representation negative integers have an infinite number of leading 1 bits, i.e. -1 is "...11111111" in binary, -2 is "...1111110", and so on. @see @ref{std::Int}, @ref{string::IntToStr} @end

Functions

@fun And(x as Int, y as Int) as Int @desc Return the bitwise and of two integers. @end @fun Or(x as Int, y as Int) as Int @desc Return the bitwise or of two integers. @end @fun Xor(x as Int, y as Int) as Int @desc Return the bitwise xor of two integers. @end @fun Neg(x as Int) as Int @desc Return the bitwise complement of an integer. @end @fun Shl(x as Int, y as Int) as Int @desc Return the integer x shifted left bitwise y positions. @end @fun Shr(x as Int, y as Int) as Int @desc Return the integer x shifted right bitwise y positions. @end