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

(java) Writing in file little endian

I'm trying to write TIFF IFDs, and I'm looking for a simple way to do the following (this code obviously is wrong but it gets the idea across of what I want): out.writeChar(12) (bytes 0-1) out.writeChar(259) (bytes 2-3) out.writeChar(3) (bytes 4-5) out.writeInt(1) (bytes 6-9) out.writeInt(1) (bytes 10-13) Would write: 0c00 0301 0300 ...

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

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

Little Endian Bitmask

I need to convert an array of integers to a little endian bitmask using Ruby. Any links or hints would be appreciated. the example says [2,7,9,11] => "4205" a = [2,7,9,11] # 4205 b = [1,2,3,4] # 0F00 def array_to_mask(arr) mask = 0 arr.each do |i| mask = mask | (1 << i) end return mask.to_s(16) end p array_to_mask(a) # a84 ...

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 = *(...

What is wrong with this arithmetic when using SDCC (Little Endian) Compiler?

I am very new at C programming and I am working on a firmware application for my MCU. This method was working fine when I was using the KEIL compiler (Big Endian) but when I switched to the SDCC compiler (Little Endian) it is not working properly. Can someone please explain what I am doing wrong??? The target device is a Silicon Labs C8...

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

How to transform phrases and words into MD5 hash?

Can anyone, please, explain to me how to transform a phrase like "I want to buy some milk" into MD5? I read Wikipedia article on MD5, but the explanation given there is beyond my comprehension: "MD5 processes a variable-length message into a fixed-length output of 128 bits. The input message is broken up into chunks of 512-bi...

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

Swap bits in c++ for a double

Im trying to change from big endian to little endian on a double. One way to go is to use double val, tmp = 5.55; ((unsigned int *)&val)[0] = ntohl(((unsigned int *)&tmp)[1]); ((unsigned int *)&val)[1] = ntohl(((unsigned int *)&tmp)[0]); But then I get a warning: "dereferencing type-punned pointer will break strict-aliasing rules" an...

receive string with chars

Hi all, i am quite new in python. I am receiving (through pyserial) string with data values. How can I parse these data to particular data structure? I know that 0-1 byte : id 2-5 byte : time1 =>but little endian (lsb first) 6-9 byte : time2 =>but little endian (lsb first) and I looking for a function: def parse_data(string): ...

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

Convert big endian to little endian when reading from a binary file

Hi I'm been looking around how to convert big endian to little endians. But I didn't find any good that could solve my problem. It seem to be there's many way you can do this conversion. Anyway this following code works ok in a big endian system. But how should I write a conversion function so it will work on little endian system as well...