byte-order

Difference between Big Endian and little Endian Byte order

what is the difference between Big Endian byte order and little Endian Byte order. These both are related to Unicode and UTF16 where we use this? ...

Byte order of DEC VAX vs IA-32

A description of the problem follows. You can skip to the bottom line if you're not interested. I am working with a data file with this description: A 109-slice MRI data set of a human head. Complete slices are stored consecutively as a 256 x 256 array. Pixels consist of 2 consecutive bytes making one binary integer. Data taken o...

check CPU type at RUN time for C program on MAC

How does a C program determine, at RUN time (not compile time), whether it's running on Little-Endian or Big-Endian CPU? The reason why it must be "run-time" check, not "complie-time", is because I'm building the program in MAC OSX's Universal Binary format, using my MAC with Intel-CPU. And this program is expected to run on both Intel...

How is each byte in an integer stored in CPU / memory?

hi guys, i have tried this char c[4]; int i=89; memcpy(&c[0],&i,4); cout<<(int)c[0]<<endl; cout<<(int)c[1]<<endl; cout<<(int)c[2]<<endl; cout<<(int)c[3]<<endl; the output is like: 89 0 0 0 which pretty trains my stomache cuz i thought the number would be saved in memory like 0x00000059 so how come c[0] is 89 ? i thought it is suppo...

How can I use 32-bit Perl to thaw something frozen with 64-bit Storable?

I'm trying to thaw a database BLOB that was frozen using Storable on a 64-bit Solaris (production) machine. When I try to thaw on a 32-bit Windows (development) PC I receive "Byte order is not compatible error". perl -v (on solaris) This is perl, v5.8.8 built for i86pc-solaris-64 perl -v (on Windows) This is perl, v5.10.1 built for MSW...

Any way to read big endian data with little endian program?

An external group provides me with a file written on a Big Endian machine, and they also provide a C++ parser for the file format. I only can run the parser on a little endian machine - is there any way to read the file using their parser without add a swapbytes() call after each read? ...

Fast sign in C++ float...are there any platform dependencies in this code?

Searching online, I have found the following routine for calculating the sign of a float in IEEE format. This could easily be extended to a double, too. // returns 1.0f for positive floats, -1.0f for negative floats, 0.0f for zero inline float fast_sign(float f) { if (((int&)f & 0x7FFFFFFF)==0) return 0.f; // test exponent & mantis...

Converting big-endian into little-endian and vice-versa in VBA

My machine is little-endian (Intel byte order). I need to read a binary file containing 16-bit signed integer data in Motorola/IEEE byte order ("big-endian"), then do some calculations, and finally write the resulting integer data in a big-endian binary file. How do I do the above in VBA, i.e. convert big-endian into little-endian and ...

Java Implementing htonl

I am communicating with a server, each message sent to the server has to be padded with the length of the message, unsigned int len = htonl(msg.size()); In C running the length through htonl and padding the message works, in Java AFAIK byte order is already in network order so I assumed all I have to do is write the string length befo...

git svn rebase resulted in byte order is not compatible error

Following is the error I am getting when I tried 'git svn rebase': Byte order is not compatible at ../../lib/Storable.pm (autosplit into ../../lib/auto/Storable/_retrieve.al) line 380, at /usr/lib/perl5/5.10/Memoize/Storable.pm line 21 The version of perl I am running is: $ perl --version This is perl, v5.10.1 (*) built for i686-cyg...

What should I #include to use 'htonl'?

I want to use the htonl function in my ruby c extension, but don't want to use any of the other internet stuff that comes with it. What would be the most minimalistic file to #include that is still portable? Looking through the header files on my computer, I can see that either machine/endian.h or sys/_endian.h would let me use them, alt...

Working with binary data in PHP

I'm writing a client for a binary socket protocol in PHP, and it's a pain. I'm currently using pack to convert numbers into binary strings, but it's lacking. Two options pack has are: Write a signed 32 bit integer in machine byte order Write an insigned 32 bit integer in big endian byte order But I need to write signed 32 bit integer...