www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/06/15/07:22:23

Message-Id: <5.0.2.1.1.20010615210251.00a99470@rsbsgpo.anu.edu.au>
X-Sender: siebke AT rsbsgpo DOT anu DOT edu DOT au
X-Mailer: QUALCOMM Windows Eudora Version 5.0.2
Date: Fri, 15 Jun 2001 21:21:05 +1000
To: djgpp AT delorie DOT com
From: Katharina Siebke <siebke AT rsbs DOT anu DOT edu DOT au>
Subject: big endian little endian, integer and unsigned short
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

here is the problem in a different form:


somebody did this code to me:

int varint;
unsigned short varshort;


varint = varshort <<16

how is the order of my bytes in an intel PC memory after this?

varint was undefined
varshort was for example: 56 7F, then 7F is MSB and 56 is LSB (right?).

is varint now :

| starting address
v
56 7F 00 00  (solution A) or
00 00 56 7F  (solution B) or
7F 56 00 00  (solution C) or
00 00 7F 56  (solution D) ????????

I need to know, but everything is turning in my haed.
Cheers



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019