HP Forums
(27S) Bitwise operators (AND, OR, XOR, NOT) - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (27S) Bitwise operators (AND, OR, XOR, NOT) (/thread-8492.html)

(27S) Bitwise operators (AND, OR, XOR, NOT) - Dave Britten - 06-12-2017 12:12 AM

Line feeds and indentation added for clarity. This should also work on a 17B, 17BII, 19B, 19BII, 95LX, 100LX, or 200LX.




A - First operand
B - Second operand (or word size for NOT)
#AND - Result of "A AND B"
#OR - Result of "A OR B"
#XOR - Result of "A XOR B"
#NOT - Result of "NOT A" with word size B bits


Enter the two operands into A and B, then solve for #AND, #OR, #XOR, or #NOT to compute the result. For the binary functions (AND, OR, XOR), A and B are the two operands. For the unary NOT, A is the operand, and B is the word size in bits. NOT assumes unsigned input and output.

All values are entered and returned as decimal integers. Use the BASE menu and store converted values to teporary registers for working with non-decimal values.


Compute 66532 AND 21556.

66532 {A}
21556 {B}
{#AND} 36

Compute 384 OR 28.

384 {A}
28 {B}
{#OR} 412

Compute 923 XOR 7777.
923 {A}
7777 {B}
{#XOR} 7674

Compute NOT 4872 with word size of 16 bits.
4872 {A}
16 {B}
{#NOT} 60663