C - Combine las three bits of a byte with a byte -



C - Combine las three bits of a byte with a byte -

lets have byte in binary: f= 01010111, i'll this: f<<3 im expecting: 10111000, @ point im going have byte, lets other 1 10111001 , want attach them result 1011110111001. basiclly, want lastly 3 bits first byte swap sec byte.

i have no thought how can this, can help me please?

thanks!

how this?

uint8_t f = 0x57; // 0b01010111 f <<= 3; // 10111000 uint8_t g = 0xb9; // 0b10111001 uint16_t out = (f << 5) | g; printf("0x%04x\n", out); > 0x17b9 // 0b1011110111001

i don't understand intermediate << 3 i'm assuming it's part of application.

c byte bit

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -