Hi, I found an exercise about memories in a site but I don't understand the solution.

The exercise says :
A word in a little-endian pc has value 3. If I transfer this value in big indian byte per byte what is the new value ?

The answer is 2*(2^24).

I suppose that 3 in little endian is
1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0

and in big endian is
0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 1

so the result is 1*(2^14) + 1*(2^15) = 1 * (2^29)

is this right ?

Recommended Answers

All 2 Replies

Endianness is about byte order, not bit order. So

00000000 00000000 00000000 00000011

in little endian is

00000011 00000000 00000000 00000000

in big endian. Keep that in mind when doing your conversions.

Endianness is about byte order, not bit order. So

00000000 00000000 00000000 00000011

in little endian is

00000011 00000000 00000000 00000000

in big endian. Keep that in mind when doing your conversions.

thanks a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.