3 Answers
3

Endianness is the way values are stored in memory. When loaded into the processor, regardless of endianness, the bit shift instruction is operating on the value in the processor's register. Therefore, loading from memory to processor is the equivalent of converting to big endian, the shifting operation comes next and then the new value is stored back in memory, which is where the little endian byte order comes into effect again.

No, bitshift, like any other part of C, is defined in terms of values, not representations. Left-shift by 1 is mutliplication by 2, right-shift is division. (As always when using bitwise operations, beware of signedness. Everything is most well-defined for unsigned integral types.)

This is basically true for integer arithmetic, but C does provide plenty of cases of representation-dependent behaviour.
–
EdmundAug 25 '11 at 3:44

@Edmund: Hm... most notably the implementation of signedness is not specified, and as a consequence the behaviour of bitwise operations (like right-shift) and of modulo and divide are implementation defined on negative integers. What other things have you in mind which are implementation-defined?
–
Kerrek SBAug 25 '11 at 10:24

Computers don't write numbers down the way we do. The value simply shifts. If you insist on looking at it byte-by-byte (even though that's not how the computer does it), you could say that on a little-endian machine, the first byte shifts left, the excess bits go into the second byte, and so on.

(By the way, little-endian makes more sense if you write the bytes vertically rather than horizontally, with higher addresses on top. Which happens to be how memory map diagrams are commonly drawn.)