I'm programming an algorithm using rf433 modules without library.
I have already created a program using arrays of booleans, and someone told me to use only int with the operator bitshift.
Someone knows if this operator spends more time than operations on array ? Because my first program spent 3 secondes for 3 messages received. And my second one using bitshift, 5 secondes for 3 messages.
Basically, the operation bitshift shifts all bits to the left on RAM, doesn't it ?
The array changes only one cell, right ?
"A << 5" is an expression. It returns whatever A contained leftshifted 5 times (which is (almost) the same as multiplying by 32).
If A is a byte and it contains B01000000 then the result will be 0, as the "1" fell off the end.
If A is an int and thus contains B0000000001000000 then the result will be 0000010000000000
If A is an array, A << 5 is illegal (it may do an address expression, but it will NOT move all elements of A) but A[1] <<5 makes sense.
Either way, "A" does not change, it is just an expression, you need to put the result somewhere:
B = A <<5 ;
or
A = A << 5 ;