"Tomï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï ¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ " schrieb:
>
#define ROTATE_LEFT(a,n)(((a)<<(n)) | (((a) & 0xffffffff)>>(32-(n))))
The question might be considered stupid, but wtf.
RotateLeft, usually known as ROL by processors, shifts all bits in a
variable to the left by n. Any bits shifted beyond the "edge" are
inserted on the other side.
I´ll just assume you want to know "why" and "what for".
As to the "why".
For a processor this is a very simple instructon.
As to the "what for".
Analog to your question i might ask "* , what does it do?". Its a simple
function/operator/commnand/instruction/whatsoever_depends_who_you_ask
which can be pretty usefull at times.
I cant recall using it myself, but i remember using shiftleft and right
often enough back in the days DIV was "forbidden" (well, not
forbidden, but performances dictated using MUL + SHR).
But being such a mean guy i wont answer the question "why would i use
it?". I´ll just ask an abstract question:
"Why would you consider writing a=b*c when you could just well write
"for(i=0,a=0;i<b;i++) a+=c""?
Same results, eh?
But well, might as well learn python and not care about efficiency.