#1,083 – Using Visual Studio to Verify Little-Endianness

We know that Intel processors use a “little-endian” scheme when deciding how to store binary data in memory.  That is, bytes from the “little end” of a number will be stored earlier in memory than the bytes from the “big end”.

We can see this little-endianness in action by using Visual Studio to look at how a data item is stored in memory.

Let’s say that we have a 4-byte (32-bit) unsigned integer with a value of 0x1234ABCD, assigned to a variable named “myNumber”.  We can view the memory location where this number is stored by bringing up the Memory window in Visual Studio and then entering “&myNumber” in the Address area.

1083-001

1083-002

When you press RETURN, you’ll see the memory location where myNumber is stored.  Notice that the first byte is CD, followed by AB, etc.  The number is stored in a little-endian manner.

1083-003

 

Advertisements

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #1,083 – Using Visual Studio to Verify Little-Endianness

  1. Pingback: Dew Drop – April 25, 2014 (#1763) | Morning Dew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: