Originally posted by biosx:
Thank you for the reply.

Do you (or anybody else for that matter) use bitwise operators alot? It seems like you would only use them for special cases like you said (Crypto and special API programming).

Is there anytime where you regularly use bitwise operators?

Any help would be very much appreciated.



Ive done some embedded control programming with small microprocessors that require bitwise operators. Mostly the operators are used for masking.

An example, which I used a lot, was when I started programing for the 68HC11. It has 4 ports and some of those can be both input and output ports (input denoted as a 0, output as 1). This was stored in DDRD (data data direction port D). If it was half in, half out then it would be:

DDRC = 00001111.

If you need to check which ports were in and which were out you could use the bitwise and to mask out all the other bits.

The main reason I can think of for the >> << operators is for quick divide and multiply by 2.