big endian vs little endian

i work on a 64 bit intel processor...i was learning about big and little endian and what i understood was that these are byte orderings within a word such that in a 64 bit data, msb will have lowest address in big endian form and the highest address in little endian i have a problem:

I wrote this code to determine whether my processor was little or big endian... I input

0102030405060708 (this is in hex) 

and hoped to get 08 and 07 and 06 and... and 01 as answer

but instead got 0 and 25 and 50 and -125 and -13 and 501 and -41 and 66. when I wrote the same code taking 's' as 2 byte(short), the output for 0102 was 2 and 1 (which is in accordance with little endian) what went wrong here?


You are storing your input value as a double, which stores the value as a floating point value. Try using a long long instead, which is a 64 bit integer, and should store the value as you expect.

Need Your Help

How to make Multiple ajax requests in a loop return values sequentially?

jquery ajax request sync

I have to make a series of Ajax requests on a loop. Around 100 of them. And each request returns a JSONP variable. I extract data from the JSON and keep appending the value into a div. The problem is

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.