Understanding bitwise operations I am wondering what the second line of code does:

int16_t GyX;
GyX=Wire.read()&lt;&lt;8|Wire.read();


Also, how can I write the GyX value to EEPROM?

From what I understand, int16_t is a two-bytes value. The Wire.read() returns a single byte. The &lt;&lt;8 shifts the bits by one byte to the left in order to read the higher order bits, and the last part writes the next wire read (lower order bits). Basically, reads wire twice and stores those values in the int. Is that correct?

For the writing, would 

EEPROM.write(addr, GyX &gt;&gt; 8); 
EEPROM.write(addr, GyX &amp; 0xff);


do the trick? (First line records the higher order bits, while second records the lower order ones)
GyX=Wire.read()&lt;&lt;8|Wire.read();


This is a bug. It reads two bytes from the I2C bus and builds a 16-bit
number from them. One of the bytes (we don't know which one) will be the
most significant byte of the result. The other byte will be the least
significant byte.

This instruction is likely to work just fine on some particular version
of some particular compiler with some particular compiler options.
Presumably it did work for the author. But you should not expect it to
work consistently across compilers, or even across different versions of
the same compiler.

The proper way to do this is to perform the two reads in different
instructions:

GyX = (uint16_t) Wire.read() &lt;&lt; 8;
GyX |= Wire.read();


assuming the bytes come most-significant first.

Edit: added (uint16_t) cast. C.f. this answer.