Quantcast
Channel: Formulating the bitwise OR operation - Mathematics Stack Exchange
Viewing all articles
Browse latest Browse all 3

Formulating the bitwise OR operation

$
0
0

Considering the bitwise OR operation, wikipedia states,

$$x\;\mathrm{OR}\;y = \sum_{n=0}^b 2^n\left[\left[\left(\lfloor\frac{x}{2^n}\rfloor\mod2\right)+\left(\lfloor\frac{y}{2^n}\rfloor\mod2\right)\\+\left(\lfloor\frac{x}{2^n}\rfloor\mod2\right)\left(\lfloor\frac{y}{2^n}\rfloor\mod2\right)\mod 2\right]\mod2\right]$$

where $b$ is the number of bits in $x = \lfloor\log_2x\rfloor+1$ for all $x\neq0$

I can see that $\left(\lfloor\frac{x}{2^n}\rfloor\mod2\right)$ and $\left(\lfloor\frac{y}{2^n}\rfloor\mod2\right)$ are the $n^{th}$ bits of x and y, respectively, but I'm having a hard time putting the rest of the derivation together.


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images