Function: bitand
Section: conversions
C-Name: gbitand
Prototype: GG
Help: bitand(x,y): bitwise "and" of two integers x and y. Negative numbers
 behave as if modulo big power of 2.
Description:
 (small, small):small:parens        $(1)&$(2)
 (gen, gen):int        gbitand($1, $2)
Doc:
 bitwise \tet{and}
 \sidx{bitwise and}of two integers $x$ and $y$, that is the integer
 $$\sum_{i} (x_{i}~\kbd{and}~y_{i}) 2^{i}$$

 Negative numbers behave $2$-adically, i.e.~the result is the $2$-adic limit
 of \kbd{bitand}$(x_{n},y_{n})$, where $x_{n}$ and $y_{n}$ are nonnegative
 integers tending to $x$ and $y$ respectively. (The result is an ordinary
 integer, possibly negative.)

 \bprog
 ? bitand(5, 3)
 %1 = 1
 ? bitand(-5, 3)
 %2 = 3
 ? bitand(-5, -3)
 %3 = -7
 @eprog
Variant: Also available is
 \fun{GEN}{ibitand}{GEN x, GEN y}, which returns the bitwise \emph{and}
 of $|x|$ and $|y|$, two integers.
