I am learning Arduino from "Arduino cookbook by Michael Margolis", i was reading about bitwise operations and extracting low and high bytes from int. He said that there is no function in Arduino to extract high and low bytes from long at the time of his writing. He stated an alternative to the problem by adding two line of code.
#define highWord(w) ((w) >> 16)
#define lowWord(w) ((w) & 0xffff)
The first line i clearly understood like this, please make corrections if i am wrong.
32bit binary of 16909060 is 0000 0001 0000 0010 0000 0011 0000 0100
by right shifting last 16 bits we will arrive at
32bit binary of 16909060 after right shifting 16bits is 0000 0000 0000 0000 0000 0001 0000 0010
I am not able to interpret the second line.
#define lowWord(w) ((w) & 0xffff)
I would be very grateful if some body explain how the above line of code works? Thanks.