(27S) Bitwise operators (AND, OR, XOR, NOT)
|
06-12-2017, 12:12 AM
Post: #1
|
|||
|
|||
(27S) Bitwise operators (AND, OR, XOR, NOT)
Line feeds and indentation added for clarity. This should also work on a 17B, 17BII, 19B, 19BII, 95LX, 100LX, or 200LX.
Code:
Variables: 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 Usage: 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. Examples: 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 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)