Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP 1

Status
Not open for further replies.

RajashreeDasari

Programmer
Jul 7, 2008
2
I am new to c language. I need to analyse a c code in which am not able to understand this lines :- nine = (u16)(in>>7);seven = (u16)(in&0x7F);
Can anybody help me understanding it.
 
That is 2 different statements:
Code:
nine = (u16)(in>>7);
seven = (u16)(in&0x7F);
>> is the right shift operator. In this case it is shifting the value of in right 7 bits, casting it to a u16 (presumably a 16-bit unsigned int) and assigning the result to the nine variable.

& is the bitwise AND operator. In this case it is ANDing in with 0x7F, casting it to a u16 type and assigning it to the seven variable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top