big-endian

Does my AMD-based machine use little endian or big endian?

I'm going though a computers system course and I'm trying to establish, for sure, if my AMD based computer is a little endian machine? I believe it is because it would be Intel-compatible. Specifically, my processor is an AMD 64 Athlon x2. I understand that this can matter in C programming. I'm writing C programs and a method I'm usin...

mmap big endian vs. little endian

If I use mmap to write uint32_t's, will I run into issues with big endian/little endian conventions? In particular, if I write some data mmap'ed on a big-endian machine, will I run into issues when I try to read that data on a little-endian machine? ...

Bitwise Not Operator (~ in C) with regards to little endian and big endian

This is in relation to a homework assignment but this is not the homework assignment. I'm having difficultly understanding if there is a difference on how the bitwise not (~ in C) would affected signed int and unsigned int when compiled on a big endian machine vs. a little endian machine. Are the bytes really "backwards" and if so do...

What's the most Pythonic way of determining endianness?

I'm trying to find the best way of working out whether the machine my code is running on is big-endian or little-endian. I have a solution that works (although I haven't tested it on a big-endian machine) but it seems a bit clunky: import struct little_endian = (struct.pack('@h', 1) == struct.pack('<h', 1)) This is just comparing a 'n...

How fast is the procedure to convert from using big endian to little endian?

How fast is the procedure to convert from using big endian to little endian? ...

How are ASCII characters stored in memory?

Consider a computer that has a byte addressable memory organized in 32 bit words according to the big endian scheme. A program reads ASCII characters entered at a keyboard and stores them in successive byte locations, starting at location 1000. Show the contents of two memory words at locations 1000 and 1004 after the name "johnson" has ...

Confusion in htons- little endian/ big endian

When I send a integer variable from one process to other through socket, and then printing the value at received end, the value is still the same without using ntohl/htonl, then where do I need to use these functions other than initializing socket structures. I understand litte/big endian. But why do we need to convert port and IP nos to...

Please verify: this converter reads the byte array as Big-Endian?

Hi! Im am porting some stuff from C# to JAVA and I need a class that can convert bytes to primitives, just lite BitConverter in .NET can. As I just posted here, I noted that my computer uses Little-Endian (Intel) and BitConverter works as expected: // C# code byte[] b2 = new byte[] { 0, 1 }; short b2short = BitConverter.ToInt16(b2, 0)...

EndianBinaryReader - Contious update of the input stream?

I am trying to use the EndianBinaryReader and EndianBinaryWriter that Jon Skeet wrote as part of his misc utils lib. It works great for the two uses I have made of it. The first reading from a Network Stream (TCPClient) where I sit in a loop reading the data as it comes in. I can create a single EndianBinaryReader and then just dispos...

Big Endian and Little Endian for Files in C++

I am trying to write some processor independent code to write some files in big endian. I have a sample of code below and I can't understand why it doesn't work. All it is supposed to do is let byte store each byte of data one by one in big endian order. In my actual program I would then write the individual byte out to a file, so I get ...

Little endian Vs Big endian

Lets say I have 4Byte integer and I want to cast it to 2Byte short integer. Am I right that in both (little and big endian) short integer will consist of 2 least significant bytes of this 4Byte integer? Second question: What will be the result of such code in little endian and big endian processor? int i = some_number; short s = *(...

Fixed/variable length structure in c# and big endian conversion

Struct { byte F1[2] SHORT F2 byte F3[512] } BPD CBD { SHORT CLENGTH byte DATA[] } Above are 2 c++ structure. Here SHORT is of 2 byte signed. What would be the best way to convert it into C#? (Note that in 2nd struture length of DATA is uundefined.) I have seen following two links. http://stackoverflow.com/questions/415214/fix...

SQL Server binary(128) convert from little endian to big endian

how to convert a binary(128) from little endian to big endian in SQL Server? ...

Marshalling a big-endian byte collection into a struct in order to pull out values

There is an insightful question about reading a C/C++ data structure in C# from a byte array, but I cannot get the code to work for my collection of big-endian (network byte order) bytes. (EDIT: Note that my real struct has more than just one field.) Is there a way to marshal the bytes into a big-endian version of the structure and then ...

Finding if the system is little endian or big endian with perl

Is there an option to find if my system is little endian byte order or big endian byte order using Perl? ...

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 ...

Convert a raw string to an array of big-endian words with Ruby

Hello, I would like to convert a raw string to an array of big-endian words. As example, here is a JavaScript function that do it well (by Paul Johnston): /* * Convert a raw string to an array of big-endian words * Characters >255 have their high-byte silently ignored. */ function rstr2binb(input) { var output = Array(input.lengt...

When processor endian awareness is required?

Hi, I am in Mac. With Cocoa, I know with normal files we can directly read or write without worrying about the endianness. When processor endian awareness is required? Regards, Dhana. ...

Perl pack use - double big endian ?

Hi, According to this calculator site (link text) , when converting 3 from dec to double I get 4008 0000 0000 0000 When using Perl pack function, with the parameter "d>*" , I expected to see 4008 0000 0000 0000 as I use this function: print $File pack("d>*",3); But when I "Hexdump" to the Perl output file, I see 0840 0000 0000 0000...

How to reverse data using an array of pointers (parse binary file)

Hey I am parsing a binary file using a specification. The file comes in big-endian mode because it has streamed packets accumulated. I have to reverse the length of the packets in order to "reinterpret_cast" them into the right variable type. (I am not able to use net/inet.h function because the packets has different lengths). The read...