binary - Multiple bitwise operators in one line -
binary - Multiple bitwise operators in one line -
ok, i'm trying shove these smaller numbers 1 32 bit number, in 1 line. since 101, b 001, , d 011, thought or shifts homecoming me 101001011, or 331. cout returns 1.
int main() { int a, b, c, d; = 5; b = 1; d = 3; c = 0; c = ( 0 || << 8 || b << 5 || d << 2 ); cout << c; system("pause"); }
you using logical "or"s. result "true". utilize single pipes "|"
c = ( 0 | << 8 | b << 5 | d << 2 );
binary operators bit-manipulation
Comments
Post a Comment