jeudi 13 août 2015

Convert uint16 to uint32? [duplicate]

unsigned int32(unsigned int16, unsigned int16) {

} I have for example 16bit variable 0000 0000 1100 1111 and 0000 0000 1000 1001

I want to copy 1111 bits to new variable, then 1001. After that 1100 and 1000. I'm asking this because i need to combine 2x16bit variables to one 32bit, using low byte of first, then low byte of second, then high byte of first and high byte of second, all that need to be stored in that order to 32bit variable.

It has to be like this ...1000 1100 1001 1111 (uint 32bit)

This has to be done using bitwise operators (&, <<, >>, |, etc.)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire