Hey so I was wondering if someone could explain how this works, I have to retrieve the 3rd bit from a byte, it is a bool value, and I i'm confused about how this actually works, and also if I have the syntax correct. I keep coming on so many different examples of how to do this. This is what I have:
if(apdu_parse[0] & (1<<3)){
apdu_bit3 = 1;
}
else if(apdu_parse[0] & (0<<3)){
apdu_bit3 = 0;
}
mpdu -> segmented_message = apdu_bit3;
what i think this does is look for the third bit of apdu_parse[0] determines if its a 1 or a 0 and stores it accordingly. as I said i keep coming across so many different examples that I think i'm starting to blend them and nothings working. the value in apdu_parse[0] is a hex value, I keep getting '93' which makes no sense.
You can simply write:
Your code will set the correct value if the bit is set but the wrong value if the bit is not set.
will always generate 0.
Thus
will always be false since