The meaning of performing logical operations on two numbers

assemblydigital-logic

If we are to consider two Boolean values, the logical operations on them make perfect sense. But what would it mean to perform AND/OR/XOR operation on two binary numbers?

I am learning Assembly level programming (in ARM7) and I'd to write a simple code that performs logical operations like AND,OR,XOR on two Hex Values.

EDIT: My question is not about the procedure of performing such operations on numbers. I'm concerned about the logical implication of such operations.
I came across a block of code that swaps the value of two registers without involving the third register or memory. The algorithm was to perform XOR operation on the numbers.
A(XOR)B = A'B + AB' ,
What actually is the meaning of A'? If A were a Boolean Value 0 or 1, A' would have been 1 or 0 respectively. I don't understand how I can extend the same logic for two numbers.

Best Answer

When speaking of logical operations on two numbers, two different kinds of operations might be the case:
1) The most common one - bitwise operation between two numbers, which, as you hopefully know, represented by bits (zeros and ones). Given two numbers, represented with 8bits each, for example, the bitwise logical operator will perform the logical operation between the two corresponding bits of the operands, putting the resulting bit into the corresponding place in the result. (say AND operation of third bits will yield result in the third bit).
2) Less common are the reduction operators, that will perform logical operations on the bits of the same operand, reducing the result to one bit. I.e. performing the reduction AND on a number will perform AND between all of it's bits and return the only one resulting bit.

Upd: The answer for your updated question:

For swapping two boolean variables A and B we might perform the following operation:

A <- A xor B 
B <- A xor B
A <- A xor B 

Here, if we denote by A' and B' the original values of A an B (please note, i am not using the ' as NOT, it just an indication to differ two variables), the lines will become:

A = A' xor B'
B = (A' xor B') xor B' = A'
A = (A' xor B') xor B =  (A' xor B') xor A' = B'

And thus the values are swapped. If we extend the same to A and B containing more than one bit, the same operation will be performed on each their bit (columnwise in your terms), effectively swapping the values of the whole numbers.