Link to home
Start Free TrialLog in
Avatar of rem2722
rem2722

asked on

What do these C expressions mean? Don't recognize these operators.

I am trying to learn embedded C for the HCS12 processor.  Come across a few operators I haven't seen before.  What do the symbols in these four expression mean?




PPSAD &= ~0x01;   // pull-up on PAD0
PERAD |=  0x03;   // enable pull-up and pull-down
column>>=1;  //shift into position
while(pt->out)

Open in new window

Avatar of Infinity08
Infinity08
Flag of Belgium image

& is the binary AND operator.
| is the binary OR operator.
>> is the binary right-shift operator.
Oh, and ~ is the binary NOT operator.
And -> is the dereference with member selection operator.
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Or, with a bit more explanation :

1) binary AND : takes the binary AND of two values. For example :

        0xAA & 0x0F == 0x0A

2) binary OR : takes the binary OR of two values. For example :

        0xA0 | 0x0F == 0xAF

3) binary NOT : takes the binary NOT of a value. For example :

        ~0x0000FFFF == 0xFFFF0000

4) binary right shift : shifts the bits in a value a given number of positions to the right. For example :

        0xA0 >> 4 == 0x0A

5) pt->out is the same as (*pt).out   or, dereference pointer to struct pt, and get the member out of that struct.
Oh well, so I guess what I said wasn't helpfull ...