I am sorry if this is a stupid question but I have looked around and can not find the answer anywhere.

What do these two operations do?

a |= b

and

a=a>>1

Printable View

- 01-29-2005the_headwhat do these operations do?
I am sorry if this is a stupid question but I have looked around and can not find the answer anywhere.

What do these two operations do?

a |= b

and

a=a>>1 - 01-29-2005quzah
Read the Bitwise Operation FAQ. All the information you need is already written up there.

Quzah. - 01-29-2005KrakQuote:

Originally Posted by**the_head**

Say a=3 and b=5

Code:`//Not actually code, but whatever.`

0011

+0101 //Add using bitwise OR

=0111 //Our result is 7.

0011 >> 1 = 0001

So 3>>1 = 1. - 01-29-2005ThantosQuote:

The first adds two variables or constants with bitwise OR

- 01-29-2005KrakQuote:

Originally Posted by**Thantos**