If we all shut up and let the pros handle it, noone would get anywhere fast. o.o
Anyway. It's a valid point that DaveC makes. It would be very fast, but there are better ways of doing it. The one already mentioned here probably would work, but I have no idea how. =(.
The mine?
It's really simple - what is really an ALU? In 32bit cpu like the ARM It's 32 dimensional vector unit with scalars what have accuracy of 1 bit. Bitwise AND is the same as arithmetical ADD just with carry for higher bit.
Carry is usefull (obviously) but trick is to prevent it from some bits so we could isolate some regions of ALU's bits.
So we can have 4 8bit values in 32bit register, right? But arithmetic ADD will mess up individual values as results of summing two 8bit can be 9bit. But when we reduce these values to 7 bits (by zeroing least significant bit of every scalar) and logically shift by one bit to left (to make place for eventual carry) we are effectively not adding one 32bit value but 4 7bit ones.
Imagine 16 bit register (to make the example shorter):
|00000000|000000000| - two bytes = 16 bits
Get two values - let it be 59 and 20:
00111011 - 59
00010100 - 20
Put them in the 16 bit register this way: |59|20| so:
|00111011|00010100|
Get another pair of 7bit numbers, lets them be 100 and 77:
01100100 - 100
01001101 - 77
Put them to another register similar way: |100|77|:
|01100100|01001101|
So we have two registers:
|00111011|00010100|
|01100100|01001101|
Arithmetically they are 15124 and 25677.
15124 + 25677 = 40801
Bitwise 40801 is equal to:
|10011111|01100001| (so |159|97|)
and
59 + 100 = 159
77 + 20 = 97
See? :rolleyes: