If I want to set the 31st bit of test_summary to the value of result, does this work? ( note: I simplified the code )
int test_summary = 0;
int result = 1;
test_summary = test_summary | result << 31;
If I want to set the 31st bit of test_summary to the value of result, does this work? ( note: I simplified the code )
int test_summary = 0;
int result = 1;
test_summary = test_summary | result << 31;
What doesn't work?Code:#include<stdio.h> int main( void ) { int test_summary = 0; int result = 1; test_summary = test_summary | result << 31; printf( "%d\n", test_summary ); return 0; }
Quzah.
Hope is the first step on the road to disappointment.
I am asking if this correct syntax or not for setting the 31st bit of test_summary to the value of result?
Now I am thinking it should be:
test_summary = test_summary & result << 31;
????
I am on the right track?