where can I ask about byte ordering

S

Snake

Hey,
where can I ask about little and big endian stuffs? here or another
newsgroup?!
I just need help in representing string c = "place" and long b =
0x11223344 in a 16 bit word memory in the little and big endian format!!
thanx
 
V

Victor Bazarov

Snake said:
where can I ask about little and big endian stuffs? here or another
newsgroup?!

Depends on what you need to know about it.
I just need help in representing string c = "place" and long b =
0x11223344 in a 16 bit word memory in the little and big endian format!!

What do you mean by "need help"? Do you just want somebody to write
it for you?
 
S

Snake

Well, yes.I want to know how they are represented in the memory.so basically
I need someone to write them in the same way they are represented in the
memory.The reasin I am sking because I am confused whether the size of word
matters when they are stored in the memory (16 bit or 32 bit).
and Giani, thanx for the website, But I am not looking for the c++ code I
just want to know how place and 11223344 are represented in memory.

for example: int a = 0x5566
little endian: 66 55
big endian: 55 66
see,but how about "place" and "0x11223344"!!
Thanx alot
 
B

Bobo

Snake said:
Hey,
where can I ask about little and big endian stuffs? here or another
newsgroup?!
I just need help in representing string c = "place" and long b =
0x11223344 in a 16 bit word memory in the little and big endian format!!
thanx

Hey! That easy!
unsigned char littleEndian[] = {0x44,0x33,0x22,0x11};
unsigned char bigEndian[] = {0x11,0x22,0x33,0x44};

HTH.
Bobo
 
O

osmium

Snake said:
Well, yes.I want to know how they are represented in the memory.so basically
I need someone to write them in the same way they are represented in the
memory.The reasin I am sking because I am confused whether the size of word
matters when they are stored in the memory (16 bit or 32 bit).
and Giani, thanx for the website, But I am not looking for the c++ code I
just want to know how place and 11223344 are represented in memory.

for example: int a = 0x5566
little endian: 66 55
big endian: 55 66
see,but how about "place" and "0x11223344"!!

Big endian, little endian only applies to scalers (think atomic), not to
aggreagte types. And place is an aggregation of bytes. The problem arises
when a hardware register, which doesn't have an address in the normal
address space¹ has to be written to RAM.

Thanx alot

Note 1. Yes, I know there are exceptions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top